$25
This homework deals with digital filters in a low-level sense
For this question, you will be working with the discrete system described bythe transfer function:
• 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 . 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 unrealisticbut 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.
• 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
• 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.