代做ECE 161A Homework 1调试Matlab程序
- 首页 >> C/C++编程Homework 1
Theoretical Problems (Not required to turn in, Just for practice)
Chapter 2: 2.21, 2.23, 2.28, 2.33, 2.44, 2.84
Matlab problem (Need to turn in):
This problem will cover the basics of Matlab for DSP, such as plotting and filtering. If you are confused as to how to use any of the Matlab commands in this assignment, you can use Matlab’s help system to get more information on it. To do this, type help followed by the name of the command at the Matlab prompt. You can also use the lookfor command to search for Matlab commands by keyword (i.e., ”filter” or ”FIR”). You’ll need to have the Signal Processing Toolbox installed to do the assignments for this class. To check for the Signal Processing Toolbox, type help signal at the Matlab prompt and you should see a list of all of the Matlab commands in the Signal Processing Toolbox.
1. Given the following discrete-time transfer function:
Use the command roots to find the locations of the poles and zeros of H(z).
2. Next, use the command zplane to plot the poles and zeros of H(z). Confirm that the roots on the plot are the same as the ones you got from the roots command. Finally, use the poly command to convert the roots back to the numerator and denominator polynomials. Do you get the same coefficients that you started with?
3. Use the freqz command to plot the magnitude and phase responses of H(e jω). Use N = 1024 points. What kind of filter is H(z)?
4. Use the impz command to plot the first 64 points of the impulse response h[n] corresponding to H(z). Next, use the filter command to produce the first 64 points of the impulse response. To do this, create a vector of the first 64 points in the unit impulse function and input it to filter, along with the numerator and denominator coefficients that describe H(z). Do you get the same impulse response as from impz?
5. Generate the first 64 points (n = 0 : 63) of the following signal:
x[n] = cos(.15πn) + 2 cos(.75πn).
Next, use freqz to plot the magnitude and phase spectra of the signal. (Hint: since we are dealing with a finite-length signal, its Z-transform. will have a denominator of 1, and the numerator coefficients will be exactly the original signal).
6. Use the filter command to filter x[n] through H(z), producing an output y[n]. Use stem to plot x[n] and y[n]. Next, use freqz to plot the magnitude and phase spectra of y[n]. What has our filter done to this signal?