$30
Full Name:
EEL 3135 – Lab #09
Question #1: (Comment Code)
There is no comment code this week! Note that there are useful functions in the skeleton code:
pzplot, DTFT, and shift.
Question #2: (IIR Filters in Difference Equations)
In this question, we will implement IIR filters in the time domain without the filter command.
Note that we assume initial rest (i.e., for every n < 0, y[n] = 0) for all parts of this question.
(a) Consider the transfer function:
H1(z) = 1 − 0.6z
−1
Answer in your comments: Express this as a difference equation.
(b) Use a for-loop (i.e., do not use the filter function) to apply the derived difference
equation onto the input x1[n] provided as x1 in the skeleton code (Hint: we have done
similar in previous labs). Use stem to plot the input x1[n] and output y1[n] in subplots.
Make sure you label your plots appropriately to receive full credit.
(c) Consider another transfer function:
H2(z) = 1
1 + 0.6z−1
Answer in your comments: Express this as a difference equation.
(d) Use a for-loop (i.e., do not use the filter function) to apply the derived difference
equation onto the input x2[n] provided as x2 in the skeleton code. Use stem to plot the
input x2[n] and output y2[n] in subplots. Label your plots appropriately to receive full credit.
(e) Now consider the transfer function:
H3(z) = (1 − 0.3e
jπ/2
z
−1
)(1 − 0.3e
−jπ/2
z
−1
)
(1 − 0.5e
jπ/3z−1)(1 − 0.5e−jπ/3z−1)
Answer in your comments: Express this as a difference equation with all real coefficients
(i.e., no imaginary numbers).
(f) Use a for-loop (i.e., do not use the filter function) to apply the derived difference
equation onto the input x3[n] provided as x3 in the skeleton code. Use stem to plot the
input x3[n] and output y3[n] in subplots. Label your plots appropriately to receive full credit.
1
Question #3: (High-Order IIR Filters) In general, the more poles and/or zeros we use, the
better we can build our filter. “Better” often means:
• sharper cut-offs (between the retained and removed frequencies)
• flatter passbands (flatter magnitudes for the retained frequencies)
• deeper stopbands (lower magnitudes for the removed frequencies)
In this problem, we will examine these properties/improvements with a well-known Butterworth
filter.
(a) Consider the following input signal x[n] (this is known as a chirp signal):
x = cos((pi/30000) * n.ˆ2)
Let 0 ≤ n ≤ 9999 and a sampling rate be fs=4000 (for the rest of the problem). Listen to
this input signal using soundsc. Answer in your comments: Describe the signal (Hint:
Pay attention to changes in the frequency).
(b) Plot the magnitude of the frequency response of the chirp signal |X(e
jωb
)|.
(c) Consider the simple low-pass filter defined by
H1(z) = 1
4
1 + z
−1 + z
−2 + z
−3
?
Use the filter function to compute the output of this system y1[n] with the input x[n]. Plot
the pole-zero plot of the system and magnitude of output in the frequency domain |Y1(e
jωb
)|.
(d) Listen to this output signal using soundsc. Answer in your comments: Describe the
output and explain how the system alters what it sounds like based on your previous plots.
(e) Find the transfer function coefficients for a 3rd-order Butterworth filter with a cut-off frequency of π/4 by using the MATLAB command:
[b, a] = butter(N, Wn)
Use help butter to understand how this function operates. Use the filter function to
compute the output of this system y2[n] with the chirp input x[n]. Plot the pole-zero plot of
this system and magnitude of output in the frequency domain |Y2(e
jωb
)|.
(f) Listen to this output signal using soundsc. Answer in your comments: Describe how
and why it sounds different from the previous filter.
(g) Find the transfer function coefficients for a 25th-order Butterworth filter. Use the filter
function to compute the output of this system y3[n] with the chirp input x[n]. Plot the
pole-zero plot of this system and magnitude of output in the frequency domain |Y3(e
jωb
)|.
(h) Listen to this output signal using soundsc. Answer in your comments: Describe how
and why it sounds different from the previous filters.
(i) Answer in your comments: Which filter does provide the most desirable effects on the
input signal (i.e., which filter is the ”best”)? Discuss the possible cons of higher-order filters
in the real-world applications.