Starting from:

$30

EEL 3135– Lab #05

Full Name:
EEL 3135– Lab #05
Question #1: (Frequency Response of Filters)
Download EEL3135 lab05 comment.m from Canvas, replace each of the corresponding comments
with the corresponding descriptions. This is designed to show you how to visualize the frequency
response of FIR filters 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. Submit
only a single published PDF file that contains both your code and the results.
Question #2: (Frequency Filtering)
This question will study a low-pass filter in the frequency domain and apply it to a sum of sinusoids
signal. You will compare this result with the convolution in the time domain. Add all code into
skeleton eel3135_lab05_skeleton.m from Canvas. Include all code (and functions) in this
one file so that everything is published to a single PDF.
(a) Create a new function H = FreqResponse(b,w) that outputs the following frequency
response of an FIR system:
H(e
jwb
) = X
M
k=0
bke
−jwkb
.
where the input b is a vector of filter coefficients, input w is a vector of angular frequencies,
and output H is the complex-valued frequency response. Include this function at the end of
the skeleton file.
(b) Let the filter coefficients be {bk} = {1, 2, 1}, generate the frequency response using the function FreqResponse. Plot the magnitude and phase responses. Use Question #1 as a guide.
(c) Given the following input signal:
x[n] = 1 + cos((π/3)n) + cos((9π/10)n + π/2).
Use FreqResponse to determine the frequency response at ˆw = 0, ˆw = π/3, and ˆw = 9π/10.
Use the disp function to display each result.
(d) Compute the output signal y[n] based on the input signal and the result in part (c). Use
subplot and stem to plot x[n] and y[n] side-by-side for a range of n containing 1 fundamental period of x[n]. Label the horizontal axis “Samples” and vertical axis “x[n]” or “y[n]”.
(e) Using the conv function, compute the convolution between the input signal x[n] (for a
range of n containing 1 fundamental period) and coefficients {bk}. Call this result z[n]. Use
subplot and stem to plot x[n] and z[n] side-by-side for a range of n containing 1 fundamental period of x[n]. Label the horizontal axis “Samples” and vertical axis “x[n]” or “z[n]”.
(f) Answer in your comments: How does z[n] compare to y[n]? Explain the cause for any
differences.
1
Question #3: (Audio Filtering)
In this problem, we will apply filters to audio signal jingle11k.wav. The audio file is produced
by The Underscore Orkestra (https://freemusicarchive.org/music/The Underscor
e Orkestra/) and modified for this assignment. The original piece is licensed under CC BY-SA
3.0.
(a) For the filter coefficients
a = [1/9, 1/9, 1/9, 1/9, 1/9, 1/9, 1/9, 1/9, 1/9];
compute the filter’s frequency response with FreqResponse to get output Ha. Plot the
magnitude and phase responses of Ha.
Answer in your comments: Is this a lowpass, highpass, or bandpass filter?
(b) Use soundsc to play the input x in the skeleton code. Apply the filter a on x with conv
and store the result in xa. Play xa with soundsc.
Answer in your comments: How does x (original sound) and xa (filtered sound) differ?
Relate this difference to the filter magnitude response.
(c) For filter coefficients
b = [1, 0, -4, 0, 6, 0, -4, 0, 1];
compute the filter’s frequency response with FreqResponse to get the output Hb. Plot the
magnitude and phase responses of Hb.
Answer in your comments: Is this a lowpass, highpass, or bandpass filter?
(d) Apply the filter b on x with conv and store the result in xb. Play xb with soundsc.
Answer in your comments: How does x (original sound) and xb (filtered sound) differ?
Relate this difference to the filter magnitude response.
(e) Use conv function to convolve b with itself to get cascaded filter coefficients c. Compute the
resulting cascaded frequency response Hc. Plot the magnitude and phase responses of Hc.
Answer in your comments: Is this a lowpass, highpass, or bandpass filter?
(f) Apply the filter c on x with conv and store the result in xc. Play xc with soundsc.
Answer in your comments: How does x (original sound) and xc (filtered sound) differ?
Relate this difference to the filter magnitude response.
2

More products