LAB3
LAB3
Student Name:
Reg. No. :
Date :
Signature :
Objectives:
The DTFT:
The operation for computing frequency spectrum can be generalized for any
discrete-time sequence x[n] as
This function is the discrete-time Fourier transform (DTFT) of x[n], which we may denote as:
The DTFT is a complex function of frequency, with magnitude |X (e^ jω)| and phase θ(ω), related
by:
Suppose we are given a finite x[n], n1<= n <=n2, and we want to plot its DTFT X(e^jω) over the
range ω0 ≤ ω ≤ ωM . One problem we have is that ω is a continuous variable, but Matlab can only
handle a finite number of values of ω. The solution to this problem is to sample the frequency axis.
The above expression gives the DTFT for one frequency sample, i.e. the one for ω = ωk . If we
wish to determine the DTFT for multiple frequency samples, we can replace the above vector-vector
multiplication with the following vector-matrix multiplication:
The matrix V can be efficiently computed using the vector outer product:
Procedure:
Step 1: Open a new script file and write the DTFT function. (15 Minutes)
Save the file in current folder, LAB3, with the name dtft.m
Using your function, compute and plot the DTFT of the following signal over −2π ≤ ω ≤ 2π:
w = linspace(-2*pi,2*pi,101);
x = [-3 2 5 6 4];
n = [-1:3];
X = dtft(x,n,w);
subplot(2,1,1),plot(w,abs(X)),xlabel('w'),ylabel('Magnitude Spectrum');
grid on;
subplot(2,1,2),plot(w,angle(X)),xlabel('w'),ylabel('Phase Spectrum');
grid on;
Q1) Check the values of DTFT,X? Look at X(1), X(2),X(51),X(52) is X periodic? What is the
fundamental period?
Q2) Compare between X(50) & X(52) and X(49) & X(53), give your note?
After that, write down the following command which call the above function
x_inv = idtft(X,w,n)
Q3) Write down the values of x signal and x_inv, Are they similar?
Homework:
1) After you have completed LAB3, you had the following Matlab function in LAB3 folder:
(dtft.m, idtft.m), use them to obtain the magnitude and phase spectrum for the rectangular
pulse: