Matlab Code For DTFT - DSP Laboratory

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Experiment No.

– 5

MATLAB CODE FOR DTFT Question 1

w = [0:100]*(pi/100);
x = (exp(j*w*4)-1)./(exp(j*w)-1);
magx = abs(x);
angx = angle(x);
realx = real(x);
imgx = imag(x);

subplot(2,2,1)
stem(w,magx);
xlabel('w');
ylabel('magnitude');
title('Magnitude plot');

subplot(2,2,2)
stem(w,angx);
xlabel('w');
ylabel('angle');
title('Angle plot');

subplot(2,2,3)
stem(w,realx);
xlabel('w');
ylabel('real part');
title('real value plot plot');

subplot(2,2,4)
stem(w,imgx);
xlabel('w');
ylabel('imaginary part');
title('Imaginary plot');
MATLAB CODE FOR DTFT Question 2

w = [0:100]*(pi/100);
x = (1)./(1-0.5.*exp(-j*w));
magx = abs(x);
angx = angle(x);
realx = real(x);
imgx = imag(x);

subplot(2,2,1)
stem(w,magx);
xlabel('w');
ylabel('magnitude');
title('Magnitude plot');

subplot(2,2,2)
stem(w,angx);
xlabel('w');
ylabel('angle');
title('Angle plot');

subplot(2,2,3)
stem(w,realx);
xlabel('w');
ylabel('real part');
title('real value plot plot');

subplot(2,2,4)
stem(w,imgx);
xlabel('w');
ylabel('imaginary part');
title('Imaginary plot');

You might also like