Uploaded by smar ton

LAB 4

advertisement
Sabancı University
Faculty of Engineering and Natural Sciences
EE 312 - DISCRETE TIME SIGNALS & SYSTEMS
Laboratory Assignment No. 4
Spring 2022 - 2023
Issued: Monday, 29 May 2023
Due: Tuesday, 6 June 2023, 5:40 pm
• Please submit a single zip file through SUCourse containing the following:
– A single pdf file containing your solutions to the problems, explanations and
comments on the results, i.e., your report
– All of the m files you have written and used for each of the problems
– All of the images and plots you have generated
Please test the submission process beforehand so you do not have problems at the last
minute. (You can submit a preliminary version and update it later).
Hint: You can write your report in a Word file and then convert this file to pdf. You
can use PDFCreator to convert Word files to pdf. You can download this program from
http://www.pdfforge.org/pdfcreator.
• Individually, each student must submit their own lab report.
• Attendance to the laboratory sessions is mandatory. The reports of those who did not
attend to a laboratory session without a valid and documented excuse will be evaluated out of 50.
Before starting to study this laboratory assignment, please analyze the code in ellipt.m to
understand the phase and amplitude response of a designed filter.
In this assignment, you are required to load the provided music signal music1.wav
as signal x into MATLAB. Load the music into MATLAB using:
[x,fs] =
audioread(’music1.wav’);. Here x is the sampled music signal and fs is the sampling
rate of that signal. You should use this sampling rate in your discrete-time filter designs. If
the signal is too long for you, you can take a 2 second portion of the music signal and use it
for the following work.
Always use a maximum passband attenuation of 0.2 dB and minimum stop- band attenuation of 45 dB in your filter designs. You may always assume a fixed 200 Hz between your
passband and stopband edge frequencies. If you cannot get a filter that can satisfy the specs,
you may relax the specs to make it possible to design the filter. For example, you may reduce
45 dB value or increase 0.2 dB value. You may also extend the distance between passband
and stopband edges. Do this only if you cannot get a filter with the given specs.
Problem 4.1
(a) Design a Butterworth IIR lowpass filter with cutoff around 600 Hz (i.e. 500 and 700 Hz
as passband and stopband edges). You can use the buttord command to calculate the
minimum order of a Butterworth filter.
(b) Design a Butterworth IIR highpass filter with cutoff around 1800 Hz (i.e. 1700 and 1900
Hz as passband and stopband edges). You can use the buttord command to calculate
the minimum order of a Butterworth filter.
(c) Plot the amplitude and phase responses of these two filters. Also plot poles and zeros
on the z-plane.
(d) Use the filter command to filter the input music signal x with the filter you designed
above and obtain x1 signal. Listen using soundsc(x1,fs) command and comment
on the quality of the output music.
Problem 4.2 Repeat steps (a)-(d) of Problem 4.1 for FIR filters designed using firpmord
and firpm commands. Note that for FIR filter design, the input mechanism for filter specs
is different. You need to translate the specs given above to the FIR filter input specs in
MATLAB.
Download