Description
In this lab, you will design linear-phase FIR filters using Matlab commands. You will approximate desired frequency responses and examine the
location of pole-zero plots for commonly used filters.
You will also study the
frequency responses of filters obtained by manipulating the impulse responses
of commonly used filters.
You will again need the last three non-zero digits of your UIC ID #, say
i, j, k. You will use the number NID = ijk = 100 ∗ i + 10 ∗ j + k in this lab
exercise.
Note that peak deviation of the magnitude response in a band is the maximum deviation from the desired magnitude in that band.
1 Design of FIR filters for common approximations
You will design FIR filters for some common approximations (lowpass, highpass, bandpass) using the “firpm” command based on the Parks-McClellan
method. The desired passband magnitude in these designs is 1.0.
1.1 Linear-Phase FIR filter design: Lowpass filter
Define frequencies: ω1 = 0.44π + 0.2 ∗NID ∗π/1000 and ω2 = π −ω1. In Matlab, use the command “firpm” to design a lowpass filter with passband edge
frequency ωp = ω1 and stopband edge frequency ωs = ω2. Use equal weights
of 1.0 for the passband and the stopband.
Denote this impulse response as
hLP and its z-transform as HLP (z). Design filters of order 6, 14, 22, 30, and
38 for these specifications.
Q4.1: What is the stopband peak absolute deviation (∆s) in each of the 5
designs? Plot −20 log10 ∆s versus the filter order.
Q4.2: Estimate the filter order required to get −20 log10 ∆s = 50 from the
plot in Q4.1. Verify using “firpm”.
Q4.3: Show a stem plot of the impulse response hLP [n] that you obtained
for filter order 14. Determine if any of the 15 values in its duration are zero
(or almost zero, with extremely small magnitude due to round-off error) and
if so whether the zeros appear in any symmetric pattern around the middle
non-zero sample.
1.2 Linear-Phase FIR filter design: highpass filter
In Matlab, use the command “firpm” to design a highpass filter with stopband
edge frequency ωs = ω1 and passband edge frequency ωp = ω2. Use filter
order 14 and equal weights of 1.0 for the passband and the stopband. Call
this impulse response hHP and its z-transform HHP (z).
Q4.4: What is the stobband magnitude deviation in the design? Compare
the filter impulse responses hLP and hHP and explain any relationship.
Q4.5 Plot absolute value of the sum of the frequency responses of the
lowpass and highpass filters |HLP (e
jω) + HHP (e
jω)|.
Q4.6: Obtain the pole-zero plots of HLP (z) and HHP (z) using the command “zplane”. Determine the location of zeros on the unit circle in each of
the two cases.
Q4.7: A signal 2 cos(ω0n) is applied as input to the highpass filter with
transfer function HHP (z). The output signal is y[n] = 0. Determine the
possible values of ω0.
2 Design of multiband filters with more general responses
Now you will design FIR filters with more general responses with the firpm
program based on the Parks-McClellan method. The desired passband magnitude in these designs is not necessarily 1.0.
2.1 Linear-Phase FIR filter design: Three-band constant magnitude filter
We will consider the design of a generalized bandstop filter in which the
desired magnitude in the two passbands may not be equal.
Define frequency:
ω1 = 0.05π+0.2∗NID∗π/1000. In Matlab, use the command “firpm” to design
a 3-band filter with frequency “care”-bands [0, ω1 + 0.1π], [ω1 + 0.25π, ω1 +
2
0.45π], and [ω1 + 0.6π, π], with desired constant magnitudes 2.0, 0.0, and 1.0,
respectively, and with peak absolute magnitude deviation from the desired
value in band 1 twice that in band 2 and three times that in band 3.
Call the
impulse response of the 3-band filter h3B and its z-transform H3B(z). Use
a filter of lowest sufficient (even) order so that the peak absolute magnitude
deviation from the desired value in band 1 is at least 0.1.
Q4.8: Show the specifications used in the command “firpm” to obtain h3B.
Determine the required filter order of h3B.
Q4.9 Find the peak absolute magnitude deviation from the desired value
in each of the three bands. Show the filter magnitude plot.
Q4.10: Using the result of this design, how would you find the impulse
response of a 3-band filter with desired constant magnitudes 3.0, 1.0, and
2.0, but with the same peak absolute magnitude deviation from the desired
value requirements as above? (Hint: Modify a single coefficient.)
2.2 Linear-Phase FIR filter design: Multiband filter with non-constant desired
magnitude
Define frequency: ω1 = 0.05π + 0.2 ∗ NID ∗ π/1000. In Matlab, use the
command “firpm” to design a 3-band filter again with frequency “care”-bands
[0, ω1 + 0.1π], [ω1 + 0.25π, ω1 + 0.4π], and [ω1 + 0.6π, π].
This time the desired
magnitudes are piecewise linear with values [3.0-1.0], [0.0-0.0], and [1.0-3.0],
with equal weight for peak absolute magnitude deviation from the desired
values in the two “pass-bands” and double the weight for the peak absolute
magnitude deviation from the desired value in the “stop”-band.
Denote the
impulse response of the piecewise linear magnitude filter as hP L and its ztransform HP L(z). Use a filter of 20.
Q4.11: Show the specifications used in the command “firpm” to obtain
hP L. Show the magnitude plot of HP L(z).