Linguistics 222b/622b

advertisement
Linguistics 582
Basics of Digital Signal Processing
Assignment 4: More on Feedforward Filters
Reading:
For this week’s homework: Steiglitz, Chap 4, section 6
For next week’s class: Steiglitz, Chap 5, sections 1-4
(1)
Create a MATLAB function to calculate and plot the magnitude and phase response of a
moving average (feedforward) filter.
I demonstrated this function in class; you just need to implement it. The logic underlying this
is the same as that in freqresp_single_delay.m (included in Asssignment4.zip). Create a
vector of test frequencies (w), compute a vector of z values from that (exp(j*w)), and compute
a vector of the transfer function values, H, from that. Plot the magnitude and angle of H as a
function of test frequency (in fractions of ). In freqresp_single_delay, H is just the sum of
two terms: b(1) + b(2) * z.^-N, where N is the number of samples associated with the delay.
This time, however, instead of a calculating H using a single equation, calculate the value of H
in a loop, by summing the contribution of each of the terms of the z polynomial -- there will be
as many terms as in the input b vector of coefficients. There is no need or use for the N input
argument in this version. The function should be called freqresp.
(2)
Apply a selection of digital filters to a buzz, and confirm that the effect of each filter on
the frequency components of the buzz is just what is predicted by your freqresp
function.
Use one of your buzz scripts to generate a buzz with a srate of 10000 and a f0 of 200
A.. For each of the filtering equations (a)-(e) below, create a vector of filter coefficients that
corresponds to the filtering equation for that filter. Call these 5 vectors a, b, c, d,e Filter the
standard buzz through each of the filters, using the filter_N function that you wrote last
time (I have put my version in Assignment4.zip, in case yours is still not working). and plot
the spectrum of the resulting waveform using the spectrum(signal, srate) function (in
Assignment4.zip)
(a)
(b)
(c)
(d)
(e)
Y(k)
Y(k)
Y(k)
Y(k)
Y(k)
= .25 (X(k) + 2X(k-1) + X(k-2))
= .25 (X(k) - 2X(k-1) + X(k-2))
= .5 (X(k) + X(k-2))
= .125(X(k) + 3X(k-1) +3X(k-2) + X(k-3))
= X(k) + X(k-8)
B. For each filter, use your freqresp function to calculate the magnitude and phase response
of the filter. If you have done everything right, the amplitudes of the harmonics of the filtered
buzz (part A) should vary according the amplitude response curves of each filter (part B). For
each of the five filters, you should save the graph of its amplitude spectrum and its magnitude
response as some picture type (using save as) and paste them into a document (Word, or
whatever) which you can email me.
(3) Add to your freqresp function a plot of the locations of the zeroes of the filter in the Z-plane. Use
the MATLAB function roots(b) to solve for the roots of the z polynomial. Then plot a unit circle in the
complex plane, and plot location of the zeroes with ‘o’. In the title of the figure, list the frequencies (in
radians/sample) where zeroes occur. Make sure you get the right frequencies for the filters in (2).
Download