PS-7-2011-Solutions

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

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

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

View Full Document

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: EE 261 The Fourier Transform and its Applications Fall 2011 Solutions to Problem Set Seven 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 1000 2000 3000 4000 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 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 % 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...
View Full Document

## This note was uploaded on 01/10/2012 for the course EE 216 taught by Professor Harris,j during the Fall '09 term at Stanford.

### Page1 / 22

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

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online