#Lab Experiment 2# Q1) T (-0.5:450-1) 0.5/450 Snapnow f1 8 f2 4 X 3 Cos (2 Pi f1 T) +5 Sin (2 Pi f2 T) Plot (T, X,) Xlabel Ylabel Title Grid
#Lab Experiment 2# Q1) T (-0.5:450-1) 0.5/450 Snapnow f1 8 f2 4 X 3 Cos (2 Pi f1 T) +5 Sin (2 Pi f2 T) Plot (T, X,) Xlabel Ylabel Title Grid
#Lab Experiment 2# Q1) T (-0.5:450-1) 0.5/450 Snapnow f1 8 f2 4 X 3 Cos (2 Pi f1 T) +5 Sin (2 Pi f2 T) Plot (T, X,) Xlabel Ylabel Title Grid
Q1)
t=[-0.5:450-1]*0.5/450
snapnow;
f1=8
f2=4
x=3*cos(2*pi*f1*t)+5*sin(2*pi*f2*t)
plot(t,x,'r')
xlabel('time')
ylabel('x(t)')
title('Linear Comabination of Sinusoids')
grid;
Q2)
t=[-0.2:700-1]*0.2/700
x=cos(16*pi*t)
x1=cos(16*pi*t-(pi/2))
plot(t,x,'r',t,x1,'b')
xlabel('time')
title('Cosine Signal and its 90 Degree Delayed Version')
legend('x','x1')
Q3)
a=[1.1 2.2 3.3 ;4.4 5.5 6.6 ; 7.7 8.8 9.9 ]
b= a^2
c=b'
a=
b=
c=
#LAB EXERCISES 3#
Q1)
t=[(-1/3):750-1]*(1/3)/750
x=(1/(2*j))*(exp(j*6*pi*t)-exp(-j*6*pi*t))
plot(t,x)
xlabel('time')
ylabel('x(t)')
title('(1/(2j))(e^(j*6*pi*t)-e^(-j*6*pi*t)')
grid
Q2)
t=[(-1/3):750-1]*(1/3)/750
x=(1/(2*j))*(exp(j*6*pi*t)-exp(-j*6*pi*t))
xe=inline('(1/2)*(1/(2*j))*((exp(j*6*pi*t)-exp(-j*6*pi*t))+(exp(j*6*pi*t)-exp(j*6*pi*t)))','t')
xo=inline('(1/2)*(1/(2*j))*((exp(j*6*pi*t)-exp(-j*6*pi*t))-(exp(j*6*pi*t)-exp(j*6*pi*t)))','t')
subplot(2,2,1)
plot(t,xe(t))
xlabel('time')
ylabel('xe(t)')
title('even signal')
subplot(2,2,2)
plot(t,xo(t))
xlabel('time')
ylabel('xo(t)')
title('odd signal')
subplot(2,2,3:4)
plot(t,x)
xlabel('time')
ylabel('x(t)')
Q3)
t1=-10:-2
t2=-2:4
t3=4:10
t=[t1 t2 t3]
u1=zeros(size(t1))
u2=ones(size(t2))
u3=zeros(size(t3))
u=[u1 u2 u3]
plot(t,u)
xlabel('time')
ylabel('x(t)')
title('unit function')
Size
a
d
1x1
1x1
Bytes
8
8
Class
Attributes
double
double
Q2)
Cleared all screen
Q3)
ntegers is cleared memory
Q4)
COS
Q7)
>> z1=3+4*j
z1 =
3.0000 + 4.0000i
>> z2=2+3*j
z2 =
2.0000 + 3.0000i
>> A=(z1)*(z2)
A =
-6.0000 +17.0000i
>> B=(z1)/(z2)
B =
1.3846 - 0.0769i
Q8)
>> abs(z1)
ans =
5
>> angle(z1)
ans =
0.9273
Q9)
>> (z2)^(1/3)
ans =
1.4519 + 0.4934i
Q10)
>> E=2*exp(j*pi/3)
E =
1.0
+ 1.7321i
Q11)
>> G=[1186,1158,1130,1102,1074]
G =
1186
Q12)
>> G(1)
ans =
1186
>> G(3)
1158
1130
1102
1074
ans =
1130
Q13)
>> y=4*G+5
y =
4749
4637
4525
>> y(2)
ans =
4637
#LAB EXAM#
Q1)a1)
>> z=6+8*j
z =
6.0000 + 8.0000i
>> real(z)
ans =
6
>> imag(z)
ans =
8
b)
>> angle(z)
ans =
0.9273
c)
>> a=[1,2;3,4]
a =
1
4413
4301
>> b=[5,6;7,8]
b =
5
7
6
8
>> a*b
ans =
19
43
22
50
>> inv(b)
ans =
-4.0000
3.5000
Q2)
3.0000
-2.5000