Starting from:
$35

$29

Homework 7 Solution

In this assignment, you will reinforce what we did in lecture today regarding MAT-LAB’s lter toolbox.

For each of the following questions, you will create a lter, create magnitude-phase plots for the lter and apply the lter to a signal. Follow these steps:

Generate MATLAB code for lters using the lter design toolbox in the signal processing toolbox ( lterDesigner).

Create a  lter object by calling the generated code.

Use the DSP toolbox’s version of freqz on the  lter object.  Make sure to include the sampling frequency in the function call as this is hardly mentioned

in the documentation. For example, if f ilter is a lter object, n is the number of points (you can use 1024) and f s is the sampling frequency, run [H; f] = f reqz(f ilter; n; f s). Note I use f instead of w since by including the sampling frequency, MATLAB scales the frequencies from [0; ] to [0; f s=2]. Hence these frequencies have units of Hertz. Keep that in mind when including units in your plots and setting the axis limits.

Create magnitude-phase plots akin to homework 6 except for the di erence mentioned above regarding f.

Apply the  lter to the signal using  lter.

Lastly, plot the Fourier Transform of the nal result using t and plot. Refer to the notes for the proper way to use t and obtain the proper scaling.

This may seem daunting, but with properly de ned functions, you may only have to do most of the work once. However, I still want unique titles for plots (maybe pass in a string?).

    1. Generate a signal that consists of a sum of sine waves of frequencies 1 to 50 kHz. Set t to be from 0 to 2 seconds, using an interval of 0.001s.


50000
signal =
fX

sin(2 f t)

=1

    2. Create a Butterworth lowpass lter with a sampling frequency of Fs = 100 kHz, a passband frequency of Fpass = 10 kHz, a stopband frequency of Fstop = 20 kHz, a passband attenuation of Apass = 5dB, and a stopband attenuation of Astop = 50dB.

1
ECE-210B Homework 7    Samuel Maltz


    3. Create a Chebychev I highpass lter with a sampling frequency of Fs = 100 kHz, a passband frequency of Fpass = 35 kHz, a stopband frequency of Fstop

        ◦ 15 kHz, a passband attenuation of Apass = 2dB, and a stopband attenuation of Astop = 40dB.

    4. Create a Chebychev II bandstop lter with a sampling frequency of Fs = 100 kHz, a passband frequency of below the frequency Fpass1 = 5 kHz and above Fpass2 = 45 kHz, a stopband frequency of between Fstop1 = 15 kHz Fstop2 = 35kHz, a passband attenuation of Apass = 5dB, and a stopband attenuation of Astop = 50dB.

    5. Create a Elliptic bandpass lter with a sampling frequency of Fs = 100 kHz, a stopband frequency of below the frequency Fstop1 = 15 kHz and above Fstop2

        ◦ 35 kHz, a passband frequency of between Fpass1 = 20 kHz Fpass2 = 30 kHz, a passband attenuation of Apass = 5dB, and a stopband attenuation of Astop = 50dB.



































2

More products