EEL 3135– Lab #08
Question #1: (Z-transform, Filtering, and Magnitude Response)
Download EEL3135 lab08 comment.m from Canvas, replace each of the corresponding comments
with the corresponding descriptions. This is designed to show you how to visualize the IIR filters
in the z-domain in MATLAB.
Note: You should run the code to help you understand how it works and help you write your
comments. You will use elements of this MATLAB code for the rest of the lab assignment.
Question #2: (Design Nulling Filters in Z-Domain)
In Lab 6, you used the nulling filters to remove noise. In this question, you will study how to design
the nulling filters in z-domain. For the following transfer functions, plot the magnitude repsonses
and pole-zero plots for ω0 = 0, π/4, and π/2.
(a) Ha(z) = (1 − e
)(1 − e
(b) Hb(z) = 1
jω0 z−1)(1−(2/3)e−jω0 z−1)
Question #3: (More Z-transform, Filtering, and Magnitude Response)
Answer in your comments: Based on the previous results, answer the following questions.
(a) What kind of filters are Ha(z) and Hb(z)? Are they a low-pass filter, high-pass filter, bandpass filter, band-stop (or notch) filter, all-pass filter, or none-of-the-above?
(b) State whether each filter is an FIR filter or an IIR filter.
(c) How does changing ω0 affect the poles and zeros?
Question #4: (IIR Filters in Z-Domain)
Cascading simple filters, for example,
H(z) = H0(z)H1(z)· · · HM−1(z)
or equivalently in time
x[n] = x0[n] ∗ x1[n] ∗ . . . ∗ xM−1[n]
is a powerful tool because each simple filter dictates the location of each pole and zero. In this
problem, we will use this concept to design complex IIR filters. Consider the signal defined by
N = 100; n = 0:(N-1);
x = cos( (pi/8)*n ) + cos( (3*pi/8)*n ) + cos( (pi/4)*n ) + …
cos( (5*pi/8)*n ) + cos( (pi/2)*n ) + cos( (3*pi/4)*n );
(a) Use filter Ha(z) from Question #2 to remove the π/2 frequency from x[n]. Plot the magnitude
of the DTFT of x[n] before and after applying the nulling filter.
(b) Cascade the filter from (a) with two Hb(z) filters from Question #2: one with ω0 = 3π/8
and one with ω0 = 5π/8. Cascade the three filters and apply to x[n]. Use Question #1 as a
guide. Plot the magnitude of the DTFT of x[n] before and after applying the nulling filter.
(c) Answer in your comments: Does the filter magnitude response improve compared with
(a)? Why / how?
(d) Now use cascading to remove all but one frequency from x[n]. That is, keep ωb = π/2. Plot
the magnitude of the DTFT of x[n] before and after applying the new filter.
(e) Change your input to
N = 1000; n = 0:N-1;
x = [cos( (pi/8)*n ) cos( (3*pi/8)*n ) cos( (pi/4)*n ) …
cos( (5*pi/8)*n ) cos( (pi/2)*n ) cos( (3*pi/4)*n )];
With your filter from (d), use soundsc to play x[n] and y[n] with a sampling rate of
fs = 2000. Turn in a .wav file of this audio output along with your PDF.
Question #5: (Designing a better Nulling Filter)
Consider the following transfer function:
H(z) = (1 − e
−1)(1 − e
(1 − αejωb0 z−1)(1 − αe−jωb0 z−1),
This filter is called a notch filter, where ωb0 represents the normalized radian frequency of the
notch and α to be a positive real number that determines the ”sharpness” of the filter.
(a) Answer in your comments: State the range for α for which the filter above is stable.
(b) Plot two pole-zero plots for the H(z). Choose ωb0 to be the frequency that you determined
in Lab 6, question 4. For the first plot, choose a value of α that makes the filter stable, and
for the second, choose a value of α that makes the filter unstable.
(c) Answer in your comments: Deduce a general rule to describe the ”sharpness” of the notch
as a function of α.
(d) Determine the difference equation of the filter using the transfer function above.
(e) Using this difference equation, create feed-forward vector b and feed-foward vector a by
choosing alpha=0.99 and w0 to be the normalized radian frequency that you chose in
(b). Apply this filter to Noisy.wav, and plot the magnitude response of the filtered signal.
Submit this .wav file along with your PDF.