共计 1694 个字符,预计需要花费 5 分钟才能阅读完成。
EECS 50 UCI
Discrete-time signals and systems
Homework 5. Extra Credit
This homework is 4 points extra credit. The winner of the contest gets another 2
points.
Upload your source code, answers to the questions, and screenshots of the program
running results in one pdf in“Question: upload”in the assignment.
To win the contest, you need to write your own code. Off-the-shelf tools and source
code is not accepted.
Info about installing matlab: https://www.oit.uci.edu/help/…
Useful matlab functions (see https://www.mathworks.com/help/):
butter butterworth filter
audioread load .wav file to obtain sampled data
audiowrite write sampled data to .wav file
sound listen to sampled audio data
freqz plot the frequency response
filter apply a filter to the input data, and obtain the output
roots find roots of a polynomial
sum calculate the sum of an array
- Design a low pass butterworth filter. You can choose arbitrary parameters. Find the
corresponding difference equation, the transfer function, and the poles. - Plot the frequency response of your filter.
- Load the input data from input.wav. Find the output of your filter. Listen to the
input and the output audio. Do you find any difference? (Note that the .wav audio file
has two audio channels, so the corresponding sampled audio data has two columns.) - In the contest, there is an unknown 2nd order filter whose transfer function is
H(z) = b0z - b1z + b2
a0z
- b1z + b2
- a1z + a2
for some unknown real constants a0, a1, a2, b0, b1, b2. This filter does not need to
be butterworth. The input is input.wav. The output of the unknown filter is
output_contest.wav (call the output data y_contest). Your task is to find a 2ndorder
filter, whose output (denoted by y) is similar to y_contest as much as possible.
Find the result of the following matlab line, and use it to fill in“Question: contest”
in the assignment.
EECS 50 2
sum(sum ((y -y_contest).^2) )
Here the squared error measures the similarity. The two sums are because we need to
sum over all time and sum over both audio channels.
- a1z + a2