<< Chapter < Page | Chapter >> Page > |
Questions or comments concerning this laboratory should be directedto Prof. Charles A. Bouman, School of Electrical and Computer Engineering, Purdue University, West Lafayette IN 47907;(765) 494-0340; bouman@ecn.purdue.edu
This is the second week of a two week laboratory that covers the Discrete Fourier Transform (DFT) and Fast Fourier Transform (FFT).The first week introduced the DFT and associated samplingand windowing effects. This laboratory will continue the discussion of the DFTand will introduce the FFT.
This section continues the analysis of the DFT started in the previous week's laboratory.
In this section, we will illustrate a representation for the DFT of
[link] that is a bit more intuitive. First create a Hamming window
of length
, using the Matlab command
x = hamming(20)
.
Then use your Matlab function
DFTsum
to compute the 20 point
DFT of
.
Plot the magnitude of the DFT,
, versus the index
.
Remember that the DFT index
starts at 0 not 1!
Our plot of the DFT has two disadvantages. First, the DFT values are plotted against rather then the frequency . Second, the arrangement of frequency samples in the DFTgoes from 0 to rather than from to , as is conventional with the DTFT.In order to plot the DFT values similar to a conventional DTFT plot, we must compute the vector of frequencies in radians per sample,and then “rotate” the plot to produce the more familiar range, to .
Let's first consider the vector w of frequencies in radians per sample.Each element of w should be the frequency of thecorresponding DFT sample , which can be computed by
However, the frequencies
should also lie in the range from
to
.
Therefore, if
, then it should be
set to
. An easy way of making this change in
Matlab 5.1 is
w(w>=pi) = w(w>=pi)-2*pi
.
The resulting vectors X and ware correct, but out of order. To reorder them,we must swap the first and second halves of the vectors. Fortunately, Matlab provides a function specifically forthis purpose, called fftshift .
Write a Matlab function to compute samples of the DTFT and their corresponding frequencies in the range to . Use the syntax
[X,w] = DTFTsamples(x)
where
x
is an
point vector,
X
is the length
vector
of DTFT samples, and
w
is the length
vector of corresponding
radial frequencies.Your function
DTFTsamples
should call your function
DFTsum
and use the Matlab function
fftshift
.
Use your function
DTFTsamples
to compute
DTFT samples of the Hamming window of length
.
Plot the magnitude of these DTFT samples versus frequencyin rad/sample.
DTFTsamples
.
Also hand in the plot of the magnitude of the DTFT samples.The spacing between samples of the DTFT is determined by the number of points in the DFT.This can lead to surprising results when the number of samples is too small.In order to illustrate this effect, consider the finite-duration signal
Notification Switch
Would you like to follow the 'Purdue digital signal processing labs (ece 438)' conversation and receive update notifications?