{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

PS-7-2009-Solutions

PS-7-2009-Solutions - EE 261 The Fourier Transform and its...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
EE 261 The Fourier Transform and its Applications Fall 2009 Problem Set Seven Due Wednesday, November 11 1. (20 points) Handel’s Hallelujah In this problem we will explore the effects of sampling with or without anti-aliasing filters. As we saw in lecture there is a significant distortion of music due to aliasing if we sample slower than twice the highest frequency component. However if we can suppress the high frequency components before sampling we can possibly avoid distortion due to aliasing. In this problem we will use an anti-aliasing filter H ( s ) whose Fourier transform is shown below. H ( s ) is available on the class web site in the Matlab file anti-aliasing.mat , which contains H ( s ) in the vector Hs . -4000 -3000 -2000 -1000 0 1000 2000 3000 4000 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 s(Hz) H(s) Figure 1: Anti aliasing filter Built into Matlab is a snippet of Handel’s Hallelujah Chorus, you load it into the workspace by typing load handel 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
This loads two variables into the workspace y that contains about 8 seconds of Handel’s Hallelujah Chorus and Fs which is the sampling frequency used. Finally here is the problem, resample the snippet of Handel’s Hallelujah Chorus down to a sampling frequency of f s = 4096hz that should be half of the original sampling frequency. Now apply the anti-aliasing filter to Handel’s Hallelujah Chorus so that you cut off all frequencies higher than 2048hz, and then resample down to f s = 4096hz. Is there any audible difference between the two versions? Why or why not. Turn in your (commented!) Matlab code along with a short discussion (2 paragraphs) of any audible difference you heard or did not hear. Hints: To resample at half the sampling rate, you can use xhalf = x(1:2:length(x)); Remember to adjust the sampling rate correctly when you use sound or wavwrite . Recall that you can use fft to take the Fourier transform, and ifft to take the inverse Fourier transform. Hs has been arranged in the same way Matlab’s fft returns Fourier transforms. To evaluate H ( s ) X ( s ) try using the .* operator. Solution: Just from observing the transfer function of the anti-aliasing filter, we expect a more “base” version when we apply the anti-aliasing filter, but that version will be free of aliasing artifacts. We implement a Matlab script to make the two versions, shown below load handel % we downsample directly yhalf = y(1:2:length(y)); % and since I have not installed OSS on my Linux box % yet, I write out to a wavfile wavwrite(yhalf,Fs/2,16,’handel2.wav’); % alternatively I could use % sound(yhalf,Fs/2,16) % and then with an AA filter... load anti-aliasing 2
Background image of page 2
% we take the fourier transform Y = fft(y); % and filter Z = Y.*Hs; % then back into the time domain z = ifft(Z); % and downsample zhalf = z(1:2:length(z)); % we scale zhalf since wavwrite wants inputs % ranging from -1 to 1 zhalf = zhalf/max(abs(zhalf)); % we write out to a file wavwrite(zhalf,Fs/2,16,’handel3.wav’); % or if I had OSS installed % sound(zhalf,Fs/2,16) consider the spectrum of the snippet Note that the signal is primarily in the low -4000 -3000 -2000 -1000 0 1000 2000 3000 4000 0 100 200 300 400 500 600 700 800 s(Hz) |Y(s)|
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}