Experiment No.
2
Relationship between DFT and DTFT
Expression for Pulse Generation and DFT
L=5;
N = 5; x =[1 1 1 1 1];
n =[0 1 2 3 4]; x = [x
zeros(1,N-L)];
stem(n,x) title('Pulse
Signal') xlabel ('Time
Sampling') grid on
DFT
k= 0:1:N-1; y = fft(x);
stem(k,abs(y))
title('Magnitude plot')
ylabel('amplitude')
xlabel ('Time Sampling')
grid on
1
fq =2*pi *(0):2*pi:2*pi *(4);
stem(fq,abs(y))
title('Magnitude plot')
ylabel('amplitude') xlabel
('Frequency(rad/sec)') grid
on
2
stem(k,angle(y))
title('Phase plot')
ylabel('anlgle') xlabel
('Time Sampling') grid
on
3
stem(fq,angle(y))
title('Phase plot')
ylabel('anlgle') xlabel
('Frequency(rad/sec)') grid
on
4
Expression and Plot of DTFT
w = 0:0.01:4*pi;
X = 1+exp(-j*w)+exp(-j*w*2)+exp(-j*w*3)+exp(-j*w*4);
magX = abs(X); angX = angle(X); plot(w/pi,magX)
title('Magnitude plot') ylabel('amplitude') xlabel
('w/pi') grid on
5
plot(w/pi,angX)
title('Phase plot')
ylabel('angle')
xlabel ('w/pi')
grid on
6
Expression of DFT with Roll number
L=5;
N = 183; x =[1 1 1 1 1];
n =[0 1 2 3 4]; x = [x
zeros(1,N-L)]; k= 0:1:N-
1; y = fft(x);
stem(k,abs(y))
title('Magnitude plot')
ylabel('amplitude')
xlabel ('Time Sampling')
grid on
7
stem(k,angle(y)) title('Phase plot') ylabel('anlgle') xlabel ('Time
Sampling') grid on %As you can see the signal is
comparable with DTFT
8
9