EE 322
Lab 7: Using MATLAB to Investigate Filter Transfer Functions
In this lab we will use MATLAB to demonstrate/simulate the frequency
response of different kinds of low pass filters, and to obtain the step
response of the filters in the time domain.
- Begin by generating a .m file that produces a pole-zero
plot of the transfer function for the following types of filters: Butterworth,
Chebyshev Type 1, Elliptic, and Bessel.
- The functions `buttap', `cheb1ap', 'besselap' and `ellipap' give the complex poles
and zeros of the filters (use help to find out about these functions).
For each filter it is necessary to specify the order N ; for the Chebyshev
Type 1 and Elliptic, you also have to specify the passband ripple Rp
; and for the Elliptic, you need to specify the stopband ripple Rs
.
- Use the `plot' function with specified character type (x or o) to generate
pole-zero plots for the filters. Use the `hold (on/off)' function to hold
one plot (say the poles) while overlaying the zeroes on the plot.
- Document the pole placement of the three filter types for the case
of six poles, 3 dB passband ripple, and (for the Elliptic filter) 80 dB
of stopband ripple. Label the pole-zero plot using the `title' command.
What is the effect on the poles and zeros of changing the ripple of the
Chebyshev and Elliptic filters?
- Some versions of MATLAB do not have a Bessel filter function.
If not find the pole placement
of a sixth-order Bessel filter by entering the polynomial coefficients
as a vector and using the `root' function to obtain its poles. (Do not
worry about a ripple specification for the Bessel filter.)
- For later use, leave all of the above filter types in your program,
commenting out all but the one being currently studied.
- Expand your program to plot the frequency response H(j w) for the four
different types of filters.
- This is done using the `poly' function to convert the pole values into
the coefficients of the denominator polynomial and the zero values into
the coefficients of the numerator polynomial. You could also use the `zp2tf'
function to convert the zero-pole representation to the polynomial representation
of the transfer function. Generate polynomials for the denominator and
numerator of H(s) , then use the function `freqs' to obtain H(jw) . To
do this, you will need to generate a vector of w values; this is best done
using the `logspace' function which gives equally spaced values for a Bode
plot. 100 to 200 values should suffice. For choosing the range of w values,
note from your plots of part A) that the filter functions are normalized
to have wo values of unity.
- Plot the magnitude (`abs') of H(j w) vs. frequency
on a loglog plot, using the `loglog' function. Use the 'hold' function to
plot the magnitude vs. frequency of all filters on one plot.
- Plot the magnitude (`abs') and phase (`angle') of H(j w) vs. frequency
on a semilog plot, using the `semilogx' function. It may be helpful to take
out jumps of 2 pi using the `unwrap' function, and to convert the phase
values from radians to degrees. You can pause between successive plots
in your program using the `pause' function.
- Compare your plots with those on p. 276 of Horowitz and Hill.
- Check
that the Chebyshev filters are `equiripple' (best done using a linear magnitude
plot) and that the ripple values are as advertised. How many ripples are
there in the pass band of a six-pole filter? What is the effect of the
zeroes in the Elliptic filter?
- [If you want to get fancy, later revise a separate copy of your program
to make plots of the frequency response vs. order for a given type of filter,
as on page 276 of Horowitz and Hill. The `for/end' and `hold' features
of MATLAB come in useful here.]
- One can tell the difference between filters from their impulse and
step responses.
- Recall from linear system theory that the the impulse response h(t)
and the step response g(t) are inverse Laplace transform of the system
function H(s) :
h(t) = L-1{H(s)}
g(t) = L-1 {H(s)/s }
- Use the MATLAB functions `step' and `impulse' to plot the step and
impulse responses for your 6-pole filters. Briefly comment on differences
in risetimes, overshoot, etc. Which filter gives the best reproduction
of a step?
© Copyright 1997 New Mexico Institute of Mining and Technology