Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Signals

and
System
Submitted By: Shravan Kumar Luitel
Group: Electrical and Electronics (Communication ) Lab sheet -4
Roll no: 31015
1. Write a Matlab code for sampling following signal.
x (t) =sin (2πF1t) + sin (2πF2t)
Take the time range t= [0:0.1:20]
F1=0.1 and F2=0.2

Code:

Xlabel ('n');
Ylabel ('x_samples');
Title ('Sample');
x_recon=0;
subplot (3,1,3);
for k=0:length(x_samples)-1
stem (0:length(x_samples)-1,x_samples);
l=k:-.1:-20+k;
x_recon=x_recon+x_samples(k+1)*sinc(l);
axis ([0 20 -2 2]);
hold ;
plot (t,x_recon,'ko');
end;
xlabel('t');
ylabel ('x_recon');
title ('Reconstructed Signal');

Figure:

Given Signal
2
x(t)

-2
0 2 4 6 8 10 12 14 16 18 20
t
Sample
2
xs amples

-2
0 5 10 15 20 25
n
Reconstructed Signal
2
xr econ

-2
0 2 4 6 8 10 12 14 16 18 20
t
Labsheet-4::Question-1

2. Find DTFT for given specifications


Num= [1 -0.6]
Den= [2 1]
Plot magnitude spectrum and phase spectrum.

2
Code:

Num = [1 -.6];
Den = [2 1];
w= -4*pi:8*pi/512:4*pi;
h=freqz (num,den,w);
subplot (2,2,1);
plot (real(h),'k.');
title ('Plot of real(h)');
SUBPLOT (2,2,2);
Plot (imag(h),'ko');
Title ('Plot of Imag(h)');
Subplot (2,2,3);
Plot (angle(h),'kx');
Title ('Plot of phase spectrum');
Subplot (2,2,4);
Plot (abs(h),'k-');
Title ('Plot of magnitude spectrum');

Figure:
Plot of real(h) Plot of Imag(h)
2 1

1.5 0.5

1 0

0.5 -0.5

0 -1
0 100 200 300 400 500 600 0 100 200 300 400 500 600

Plot of phase spectrum Plot of magnitude spectrum


1.5 2

1
1.5
0.5

0 1

-0.5
0.5
-1

-1.5 0
0 100 200 300 400 500 600 0 100 200 300 400 500 600
Labsheet-4::Question-3

3. Write a Matlab code for finding CTFT of following signal.


a. x(t)=2cos(10πt)
b. x(t)=ce5t
Plot magnitude spectrum and phase spectrum.

b. Code:

t=0:0.01:2;
c=2;
x=c* exp (5*t);
N=100;
y=fft(x,N);
subplot (3,1,1);
plot (t,x,'k*');
title ('Given Signal x(t)=2cos(10*pi*t)');
subplot (3,1,2);
plot (abs(y),'ks');

3
title ('Plot of abs(y)');
subplot (3,1,3);
plot (angle(y),'kd');
title ('Plot of angle(y)');
b. Figure:
4
x 10 Given Signal x(t)=2cos(10*pi*t)
6

0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Plot of abs(y)
6000

4000

2000

0
0 10 20 30 40 50 60 70 80 90 100
Plot of angle(y)
5

-5
0 10 20 30 40 50 60 70 80 90 100
Labsheet-4::Question-2b

a. Code:

t=0:0.01:2;
x=2*cos(10*pi*t);
N=100;
y=fft(x,N);
subplot (3,1,1);
plot (t,x,'kp');
grid;
title ('Given Signal x(t)=2cos(10*pi*t)');
subplot (3,1,2);
plot (abs(y),'k');
grid;
title ('Plot of abs(y)');
subplot (3,1,3);
plot (angle(y),'k:');
grid;
title ('Plot of angle(y)');

a. Figure:

4
Given Signal x(t)=2cos(10*pi*t)
2

-2
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Plot of abs(y)
100

50

0
0 10 20 30 40 50 60 70 80 90 100
Plot of angle(y)
5

-5
0 10 20 30 40 50 60 70 80 90 100
Labsheet-4::Question-2a

You might also like