0% found this document useful (0 votes)
86 views2 pages

Matlab Code For DTFT - DSP Laboratory

This MATLAB code calculates the discrete-time Fourier transform (DTFT) of two signals. It generates the magnitude, angle, real, and imaginary components of the DTFT for each signal over frequency values from 0 to pi in steps of pi/100. The components are plotted in separate subplots to visualize the DTFT.

Uploaded by

Riyank Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
86 views2 pages

Matlab Code For DTFT - DSP Laboratory

This MATLAB code calculates the discrete-time Fourier transform (DTFT) of two signals. It generates the magnitude, angle, real, and imaginary components of the DTFT for each signal over frequency values from 0 to pi in steps of pi/100. The components are plotted in separate subplots to visualize the DTFT.

Uploaded by

Riyank Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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