Professional Documents
Culture Documents
Matlab Code For DTFT - DSP Laboratory
Matlab Code For DTFT - DSP Laboratory
Matlab Code For DTFT - DSP Laboratory
– 5
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');