Title: Lab 6 (EASY)
1Lab 6 (EASY)
2Fast Convolution
- Lab objectives
- Implement a bandpass filter in the frequency
domain, using a Hamming window function. - Filter the noisy signal generated in Lab 3, and
plot the result. - Write the result to a .wav file for playback
3Fast Convolution
In lab 3, we generated a 5 second long, 40000
sample, wave file continaining noise, a 1000 Hz.
sinusoid, and a 1500 Hz. sinusoid. In this lab,
well process the first 8192 samples of this
complex signal. Well create a frequency domain
Hamming window, centered at 1500 Hz., to
attenuate the 1000 Hz. sinusoid while passing the
1500 Hz. sinusoid
4Fast Convolution
When we take the 8192 point FFT of this signal,
which was sampled at fs 8000 Hz, the first 4096
samples in the FFT output represent frequencies
from 0 Hz. to 4000 Hz. Samples 4097 through 8192
represent -4000 Hz to 0 Hz. Therefore, we need a
gaussian window centered at
5Fast Convolution
The Hamming window function is given by
In this case, well make the window 200 points
wide, so N 200.
6Fast Convolution
In Matlab, index linspace(0, 199,
200) Hamming 0.54-0.46cos(2 pi index /
(199))
Now, well create a vector containing the
frequency response of our filter H zeros(8192,
1)
7Fast Convolution
and well place the filter window so that its
centered at sample number 1536, with a negative
frequency replica at sample 8191 1536
6655 H(14361635) Hamming H(6755-16556)
Hamming(200-11)
8Fast Convolution
Next, either read your wav file from Lab 3, or
generate the same noisy signal. Store the signal
in a vector called x. Take the FFT of the first
8192 points in that vector, and store it in a
vector xf xf fft(x(18192)
Multiply xf by H, point by point yf xf . H
9Fast Convolution
Take the Inverse FFT of yf, and write its real
part to a wav file using wavwrite or auwrite. y
ifft(yf)
Turn in an m-file implementing the above
procedure, and a wav file containing the output.
MAKE SURE IT WORKS BEFORE YOU SEND IT TO ME!