Lab 4
Lab 4
Lab 4: DFT
Instructions:
1. Lab report to be submitted (on Nalanda) on the day of the lab during lab hours, latest by 6 PM; late
submission will not be considered; use the lab hours to finish all the work
2. All the tasks in each lab have to be in one main MATLAB file with a “.m” extension; differentiate each
question by commenting. Alternatively, you can zip all .m files together, name them appropriately and
upload one zip/rar file. Make one word/pdf file with all the results corresponding to the questions
3. Plots should include x label, y label, legend, and titles
4. File name: ID_Lab1.m/ID_Lab1.rar or zip and ID_Lab1.pdf
5. If the report/code is found to be copied, zero marks will be awarded
Note: Do not use the fft command to calculate DFT for this lab exercise, implement DFT using
the matrix method discussed in the lecture.
1. Consider the following finite-length sequence.
a) Determine the DFT X(k) of x(n). Plot (using the stem function) its magnitude and
phase.
b) Plot the magnitude and phase of the DTFT X(ejω) of x(n).
c) Verify that the above DFT is the sampled version of X(ejω). It might be helpful to
combine the above two plots in one graph using the hold function.
d) Make use of the interpolation formula discussed in the lecture to reconstruct the DTFT
X(ejω) from the DFT X(k). Plot your result and comment on the same.
2. Let X(k) denote the N-point DFT of an N-point sequence x(n). The DFT X(k) itself is an N-point
sequence. If the DFT of X(k) is computed to obtain another N-point sequence x1(n), we can
show that x1(n) = N x ((−n)) N, 0 ≤ n ≤ N – 1. Using this property, design a MATLAB function to
implement an N-point circular folding operation x2(n) = x1((−n)) N. The format should be
_______________________________
x2 = circfold (x1, N)
% Circular folding using DFT
% x2 = circfold (x1, N)
% x2 = circularly folded output sequence
% x1 = input sequence of length <= N
% N = circular buffer length
______________________________________
Determine the circular folding of the sequence: x1(n) = {1, 3, 5, 7, 9, −7, −5, −3, −1}
3. Let a finite-length sequence be given by
Plot the DTFT X(ejω) of the above sequence using DFT as a computation tool. Choose the
length N of the DFT so that this plot appears to be a smooth graph.
---------------------------------------------------------