# ECE-210B Homework 6 solution

\$30.00

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

## Description

5/5 - (6 votes)

This homework deals with digital filters in a low-level sense. You are expected to
know a bit about the z-transform, but if you are not in Signals and Systems, please
contact me separately for some additional information on this homework if you need
it. Read the parts carefully and make sure to complete every part of the homework.
This homework requires you to produce a few plots; I want nice plots! Axis labels
and titles are a must.
1. For this question, you will be working with the discrete system described by
the transfer function:
H(z) =
2
5
z
2 +
1
4
z +
1
7
1
3
z
3 −
1
8
z +
3
2
• Store this transfer function as numerator and denominator polynomials.
Be VERY careful setting this up. Check the documentation for zplane
to see how discrete transfer functions are handled in MATLAB.
• Compute the poles and zeros using a specific MATLAB function. (Make
sure you use the right one for discrete signals and not the one used mostly
for continuous signals!)
• Create a poly zero plot using a different MATLAB function. You may use
either the poles and zeros themselves or the numerator and denominator
polynomials.
• Use impz to compute the impulse response of this transfer function. Compute only the first 50 points of it (there is a way to do this in the function
itself). Make a stem plot of the impulse response.
• Let x[n] = (−
4
5
)
n
. Then use filter to apply the transfer function (or
filter) to the signal. In subplots, plot the before and after.
• The above is the easiest way to apply a filter, but you also ought to be
able to do this analytically, using either convolution in MATLAB or the
product of z-transforms. Show me you know how to do this! That is,
plot the same answer achieved in another way. You don’t have to take
any inverse z-transforms to do this! Note that if you use convolution with
the impulse response, you’ll get a longer vector than when you used filter.
Therefore, only plot the first n points where n is the length of the vector
result from the previous part.
2. In this question, you will be ”designing” a bandpass filter (probably unrealistic
but it’s what I came up with). A bandpass filter is a system which only allows
a certain band of frequencies from a signal to pass.
1
ECE-210B Homework 6
• Last question you converted a transfer function in tf form to one in zpk
form. Now we will do the opposite. Compute numerator and denominator
vectors for a transfer function with k = 0.01 and these zeros and poles:
zeros : −1, 1
poles : 0.9e
j
π
2 , 0.9e
−j
π
2 , 0.95e
j

12 , 0.95e
−j

12 , 0.95e
j

12 , 0.95e
−j

12
• Create a pole-zero plot.
• Now compute the frequency response of this filter using freqz . Use n =
1024 points and return an H frequency response vector and a w frequency
vector. DO NOT use the option to plot the frequency response. You
will be manually creating the plots.
• The H vector is a complex vector. That means it has both magnitude
gain (via abs) and phase (via angle). Using subplots, plot the magnitude
and phase against the w frequency vector. A few things to note (and will
be expected in addition to proper plots):
– Plot the magnitude in dB. You can convert a gain x to dB via
20log10(x).
– Plot the phase in degrees. You will notice if you do that, the plot
will have weird sharp edges. Remove them using unwrap before
converting to degrees.
– Show units in the axis labels. (Remember the frequency vector, w,
has units radians not radians per second.)
– Remember the frequency vector, w, only goes from 0 to π. Make sure
to use xlim, xticks and xticklabels.
2