<< 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

Introduction

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.

Continuation of dft analysis

This section continues the analysis of the DFT started in the previous week's laboratory.

(DFT) X N ( k ) = n = 0 N - 1 x ( n ) e - j 2 π k n / N (inverse DFT) x ( n ) = 1 N k = 0 N - 1 X N ( k ) e j 2 π k n / N

Shifting the frequency range

In this section, we will illustrate a representation for the DFT of [link] that is a bit more intuitive. First create a Hamming window x of length N = 20 , using the Matlab command x = hamming(20) . Then use your Matlab function DFTsum to compute the 20 point DFT of x . Plot the magnitude of the DFT, | X 20 ( k ) | , versus the index k . Remember that the DFT index k starts at 0 not 1!

Hand in the plot of the | X 20 ( k ) | . Circle the regions of the plot corresponding to low frequency components.

Our plot of the DFT has two disadvantages. First, the DFT values are plotted against k rather then the frequency ω . Second, the arrangement of frequency samples in the DFTgoes from 0 to 2 π 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 X ( k ) , which can be computed by

ω = 2 π k / N k [ 0 , , N - 1 ] .

However, the frequencies should also lie in the range from - π to π . Therefore, if ω π , then it should be set to ω - 2 π . 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 N point vector, X is the length N vector of DTFT samples, and w is the length N 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 N = 20 . Plot the magnitude of these DTFT samples versus frequencyin rad/sample.

Hand in the code for your function DTFTsamples . Also hand in the plot of the magnitude of the DTFT samples.

Zero padding

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

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Purdue digital signal processing labs (ece 438). OpenStax CNX. Sep 14, 2009 Download for free at http://cnx.org/content/col10593/1.4
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Purdue digital signal processing labs (ece 438)' conversation and receive update notifications?

Ask