Lab 5: The FFT and Digital Filtering: 1. Goals
Lab 5: The FFT and Digital Filtering: 1. Goals
Lab 5
1. Goals
The goal of this lab is to help students become familiar with using the FFT to study the frequency content of a discrete-time signal. This lab is also to play with Signal Processing Tool to create some digital filters, then evaluate their behavior.
2. Lab resource
- PC with Matlab - Matlab file: frevalz.m
3. Assignments
3.1. Matlab function fft (25%) In this problem you will learn how to use the MATLAB command fft which computes the Discrete Fourier Transform (DFT) of a sequence. First, use the help feature in MATLAB to learn the syntax of the fft command. In general the FFT of a sequence will be a complex function, so you will need to look at the magnitude and phase separately. The MATLAB commands abs and angle are useful for obtaining the magnitude and phase of a complex valued sequence. Also, since the FFT only has values at discrete frequencies, it may be useful to do the plots with stem to reinforce that idea, but continuous frequency plots (i.e. using plot) are often used since they are closer to the DTFT that you are ultimately interested in. The FFT outputs a sequence that corresponds to the range 0 2 . You are probably more familiar with seeing the spectrum plotted over the range < . The fftshift function can be used for this purpose.
Plot the magnitude of the FFT of the following signal before and after the fftshift
x[n ] = 1 + cos(2 fn ); 0 n 127 for the cases where f = 0.25 and f = 0.5 . Use your understanding of the relation between discrete and continuous time to plot the magnitude of the Fourier Transform of the continuous time signal that these correspond to, assuming that the sampling period is T = 104 . Be sure to label the frequency axis correctly and indicate whether you are plotting in radians or Hertz or normalized frequency. Turn in a 3-part plot for each signal: unshifted DFT, shifted DFT, and the shifted DFT with a Hz frequency scale. Discuss why the frequency peak locations make sense.
EE 341
Lab 5
Plot the magnitude and phase plots (using plot), where the magnitude and phase plots are over the range 0.5 < 0.5 (normalized frequency, i.e. use fftshift). a) x1[n ] = sinc( f1 ( n 32)) . b) x2 [n ] = sinc( f1 ( n 32))( 1) n .
c) x3[n ] = sinc( f1 ( n 32)) cos(2 f 2 n ) where f 2 = 0.2 . d) x4 [n ] = sinc( f 3 ( n 32)) cos(2 f 3n ) where f 3 = 0.4 . What type of signals are these (low pass, high pass, etc.)? Turn in the plots only for (d). Explain why (d) does not have a flat frequency response in the passband.
EE 341
Lab 5
Use the MATLAB function filter to implement the IIR low pass filter youve just produced with the same input in problem 3. Comment on the differences in the output of the two filters. Hand in a plot of the time signal input together with the outputs of both filters.
GOOD LUCK!!!