You are on page 1of 8

EC Department

Government Engineering College, Rajkot


EXERCISE: - 2

(1) Implement Y=mX+c ; where m & c are constant , take m=0.5, c=-2 &
x=[0,1.5,3,4,5,7,9,10]
>> m =0.5
m = 0.5000
>> c =-2
c = -2
>> x=[0,1.5,3,4,5,7,9,10]
x = 0 1.5000 3.0000 4.0000 5.0000 7.0000 9.0000 10.0000
>> Y=(m*x)+c
Y = -2.0000 -1.2500 -0.5000

0 0.5000 1.5000 2.5000 3.0000

(2) Create a vector T with implement from 1:10, now compute x= tsint.
>> t=[1:10]
t=1

10

>> X=t.*sin(t)
X = Columns 1 through 9
0.8415 1.8186 0.4234 -3.0272 -4.7946 -1.6765 4.5989 7.9149
3.7091
Column 10
-5.4402

LAB MANUAL SIGNAL & SYSTEMS

EC Department
I.

Government Engineering College, Rajkot

Y= t-1/t+1
>> Y=t-1./t+1
Y=
Columns 1 through 9

1.0000 2.5000 3.6667 4.7500 5.8000 6.8333 7.8571


8.8750 9.8889
Column 10
10.9000

II.

Z=sin( )/
>> z=[sin(t.^2)./(t.^2)]
z=
Columns 1 through 9
0.8415 -0.1892 0.0458 -0.0180 -0.0053 -0.0275 -0.0195
0.0144 -0.0078
Column 10
-0.0051

(3) Point on circle X=rcos(theta) & Y=rsin(theta), where r=constant which is a


radius and it satisfy the equation
+
= . Create a theta vector with
values (0, 4 , 2 , 3 4 , , 5 2) where r=2. Compute column vector X
&Y and also calculate
+ .
>> r=2
r=2

LAB MANUAL SIGNAL & SYSTEMS

EC Department

Government Engineering College, Rajkot

>> theta=[0 pi/4 pi/2 3*(pi/4) pi 5*(pi/2)]


theta = 0 0.7854 1.5708 2.3562 3.1416 7.8540
>> X=r*cos(theta)
X = 2.0000 1.4142 0.0000 -1.4142 -2.0000 0.0000
>> Y=r*sin(theta)
Y = 0 1.4142 2.0000 1.4142 0.0000 2.0000
>> (X.^2)+(Y.^2)
ans = 4

(4) Consider two matrix:


1
A= 2
1

0 1
3 4
6 7

7
B= 2
1

4 2
3 4
6 7

Using MATLAB determine following:


1. A+B
2. A*B
3. Sqrt(A)
4.
5.
6.

7. ( + ) ( )
8. Det(A)
9. Det(B)
10.Det(AB)

LAB MANUAL SIGNAL & SYSTEMS

EC Department

Government Engineering College, Rajkot

>> A=[1 0 1;2 3 4;-1 6 7]


A=
1
2
-1

0
3
6

1
4
7

>> B=[7 4 2;2 3 4;-1 6 7]


B=
7
2
-1

4
3
6

2
4
7

>> A+B
ans =

-2 12 14

>> A*B
ans =

6 10

16 41 44
-2 56 71

LAB MANUAL SIGNAL & SYSTEMS

EC Department

Government Engineering College, Rajkot

>> A^2
ans =

4 33 42
4 60 72
>> A'
ans =

2 -1

>> B'
ans =

2 -1

>> B'*A'
ans =

6 16 -2
10 41 56
9 44 71

LAB MANUAL SIGNAL & SYSTEMS

EC Department

Government Engineering College, Rajkot

>> (A^2+B^2)-(A-B)
ans =

61 62 53
20 74 86
2 116 143

>> det(A)
ans =

12

>> det(B)
ans =

-63.0000

>> det(A*B)
ans =

-756.0000
(5) Determine eigen value and eigen vector of A & B using MATLAB.
4 2 3
A= 1 1 3
2 5 7
LAB MANUAL SIGNAL & SYSTEMS

1 2
B= 8 7
5 3

3
6
1
6

EC Department

Government Engineering College, Rajkot

>> A=[4 2 -3;-1 1 3;2 5 7]


A=
4
-1
2

2 -3
1 3
5 7

>> B=[1 2 3;8 7 6;5 3 1]


B=
1
8
5

2
7
3

3
6
1

>> eig(A)
ans =
0.5949
3.0000
8.4051
>> eig(B)
ans =
11.8655
-2.8655
0.0000

LAB MANUAL SIGNAL & SYSTEMS

EC Department

Government Engineering College, Rajkot

>> [V,D]=eig(A)
V=
-0.6713 0.9163 -0.3905
0.6713 -0.3984 0.3905
-0.3144 0.0398 0.8337
D=
0.5949
0
0
0 3.0000
0
0
0 8.4051
>> [V,D]=eig(B)
V=
0.2657 0.6220 0.4082
0.8910 -0.0285 -0.8165
0.3683 -0.7825 0.4082
D=
11.8655
0
0
0 -2.8655
0
0
0 0.0000

LAB MANUAL SIGNAL & SYSTEMS

You might also like