Matlab includes a demonstration of how to filter a signal with a band pass filter. This demo can be run by typing ‘demo’ and then choosing ‘Toolboxes,’ ‘Signal Processing’ and ‘Filtering a Signal.’
; Study the Matlab code provided in the demo to answer the following questions:
(a) Using an ordinary mathematical equation (rather than a Matlab-style
equation), write out the input signal used.
(b) What type of band pass filter is used?
(c) What are the pass band edge frequencies of the filter?
(d) What is the sampling rate?
Another demonstration, called ‘Interactive Low Pass Filter Design,’ is available to help you choose the order for your IIR filter. Run it and try changing the pass band and stop band ripples and also where the pass band and stop band edges occur. You can also change sampling rate. Note that clicking on filter type causes the display to update. When you enter a number, do not hit enter. Stop band edge must be greater than pass band edge. The order that is computer-generated (beside ‘Auto’) is one less than our
formulas from class will calculate, but is exactly the number to enter in your Matlab commands.
For each of the following filter specifications:
; Use the ‘Interactive Low Pass Filter Design’ demo to choose an order for your filter.
; Print a copy of the filter response from the demo.
; Use the appropriate Matlab command (butter, cheby1, cheby2, …) to determine the
actual filter coefficient values (the a’s and b’s) that would be required. List the
coefficients as well as the command that produced them.
Using code similar to the following, verify that your design is correct by duplicating the filter shape you see in the demo. You will need to choose a suitable maximum frequency to display.
EDU>> g = filt(b,a,sampling interval);
EDU>> w = 0:1: (2*;*max freq)
EDU>> h = freqresp(g,w);
To make your plot look as similar as possible to the plot from the demo, you may wish to use the ‘axis’ command. If you need it, use the format
axis([xmin xmax ymin ymax]);
IIR Filters 1
; Print a copy of your filter shape. Choose limits that make your plot as similar as
possible to the plot from your demo, for comparison purposes.
; Make measurements on your plot to verify that the design criteria have been met.
Design Specification 1
Sampling frequency 15 kHz
-3dB frequency 3 kHz
Stopband attenuation -20dB
Stopband edge 4.5 kHz
Design Specification 2
Chebyshev Type I characteristic
Center frequency 5 kHz
Pass band edges at -5dB, 3.5 kHz and 6.5 kHz Stop band edges at -30dB, 3.4 kHz and 6.6 kHz Sampling Frequency 15 kHz
IIR Filters 2