EE473 Homework #5
Reading : Chapter 8
The first two problems this week are about the interpretation of the DFT. The third problem deals with filtering using the DFT. Please give more thought to the parts which ask you to comment on your results.
We have only 32 samples of a sinusoidal sequence x[n] given as:
> x[n]=1/64cos(pn/4)
Plot the magnitude of the 32-point DFT (FFT) of these 32 samples.
Plot the magnitude of the 64-point DFT (FFT) of the sequence formed by padding those 32 samples with 32 zero samples.
Explain your results
For this problem
Plot the magnitude of the 64-point DFT (FFT) of the 64 points of
x[n]=1/32sin(0.2pn) for n = 0,1,...,63
Plot the magnitude of the 60-point DFT of the 60 points of
x[n]=1/32sin(0.2pn) for n = 0,1,...,59
Explain your results.
For this problem you need to download the image signal in file origimg.mat . After typing load origimg.mat there will be a variable img which represents the image signal. You can use colormap(gray) if you want to use a non-color printer. Otherwise you can use colormap(map) before displaying the image with image command.
Write a MATLAB function filtdes which takes as arguments four parameters, img, N,M, and type. Here img is the image to be filtered. N is the DFT point size. type is a string equal to either 'lowpass', 'highpass', or 'linear'. If type is 'lowpass' or 'highpass' then M is the cutoff frequency of the filter in radians/sec. If type is 'linear' then M is the group delay of the filter. That is, the filter has the form, H(ejw)= exp(-j*M*w). Your MATLAB function should first plot the the magnitude of the row-averaged magnitude spectrum and then, in the same graphics window (use subplot), plot the magnitude response of the requested filter. Then filter and display the filtered image. Finally, plot the row-averaged magnitude spectrum of the filtered image. Turn in your MATLAB program listing and hardcopy of filtered images. In each case use a value of N equal to the width of the image. For the low pass and highpass filters use M= pi/4. For the linear phase filter use M=50. Your filter should operate on each rowseparately.
Repeat a) using N=512.
Explain your results.
Hints: First try to take the DFT of each row of the image and then display the IDFT of that, i.e., try to recover the original image from the transformed image without filtering. It should then be easy to "add in" the filter. Remember that the transform of a real (not complex) signal satisfies certain symmetry conditions. Make sure that your filtered image does not violate those conditions.