Lab6
Lab6
Lab6
By:Hitham Jleed
http://www.site.uottawa.ca/~hjlee103/
© H. Jleed: 2018 ~
Assignment 06
© H. Jleed: 2018 ~
Butterworth Filter
•Named after: British Physicist Stephen Butterworth
•Butterworth filter response:
the passband response offers the steepest roll-off without inducing a passband ripple.
In addition to the flat passband response
© H. Jleed: 2018 ~
a) Design a fifth-order digital Butterworth low-pass filter with a sampling frequency of 200 Hz and a passband edge of 60 Hz. Use the
butter function. Plot the phase and magnitude frequency response using freqz. Find the zeros and the poles, and plot them on the same
z-plane { option : old way: (using plot(roots(a),’x’) and plot(roots(b),’o’)}. Plot the significant (energetic) part of the impulse response
of the filter, using impz. .
fvtool(b,a,'Fs',fs)
© H. Jleed: 2018 ~
Chebyshev Filter
•Named after: Russian mathematician Pafnuty Chebyshev
•Chebyshev filter response:
The Chebyshev filter is known for it's ripple response. This ripple response can be
designed to be present in the passband (Chebyshev Type 1) or in the stopband
(Chebyshev Type 2).
© H. Jleed: 2018 ~
b) Repeat a) but use a Chebyshev type I filter with a passband ripple of 0.5 dB. Use the cheby1
function. Compare with the plots found in a).
n = 5; fp = 60; fs = 200; Rp = 0.5; [b,a]=cheby1(n,Rp,fp/(fs/2));
fvtool(b,a,'Fs',fs)
© H. Jleed: 2018 ~
c) Repeat a) but use a Chebyshev type 2 filter with stopband edge of 65 Hz and a stopband ripple 30
dB less than the passband. Use the cheby2 function. Compare with the plots found in a).
n = 5; fp = 65; fs = 200; Rs = 30; [b,a]=cheby2(n,Rs,fp/(fs/2));
fvtool(b,a,'Fs',fs)
© H. Jleed: 2018 ~
Elliptic (Cauer) Filter
•Named after: German Mathematician Wilhelm Cauer
•Elliptic filter response:
The elliptic filters is characterized by ripple that exists in both the passband, as well as
the stopband. The passband ripple of the elliptic filter is similar to the Chebyshev
filter, however the selectivity is greatly improved.
© H. Jleed: 2018 ~
d) Repeat a) but use an elliptic (Cauer) filter with a passband ripple of 0.5 dB and a stopband ripple
30 dB less than the passband. Use the ellip function. Compare with the plots found in a).
[b,a] = ellip(n,Rp,Rs,fc/(fs/2))
fvtool(b,a,'Fs',fs)
© H. Jleed: 2018 ~
e) Matlab provides functions to estimate the order required
for different types of IIR filters in order to meet some
specifications. For the following specifications :
© H. Jleed: 2018 ~
Analog Butterworth
h) Design the low-pass analog 4th order Butterworth filter using the passband edge found in g) and the
function butter(N,Wn,'s'). Verify the frequency response and stability (via the impulse response), using the
freqs and impulse(b,a,Tf) functions for analog systems.
© H. Jleed: 2018 ~
Bilinear: Analog -> Digital
i) Using the [b2,a2] = bilinear(b,a,Fs) command, transform the continuous time filter to a discrete time filter.
Check the frequency response of the digital filter. Does it meet the specifications ? Design an equivalent filter
directly in the discrete time domain using butter, and compare the results.
n = 4; fs = 40000; fp = 8000;wp = 2*pi*fp/fs; Om_p = 2*fs*tan(wp/2); %
or 2*tan(wp/2); but use below [b2, a2] = bilinear(b, a, 1);
© H. Jleed: 2018 ~
Design of filters by frequency transformation
j) It is possible to directly design a digital IIR highpass, bandpass or band reject filter using the butter,
cheby1, cheby2 and ellip functions. Design a 5th order Chebyshev type I bandpass filter with a sampling
frequency of 20 Hz, a lower passband edge of 5 Hz, an upper passband edge of 8 Hz, and a passband
ripple of 1 dB. Plot the frequency response and the impulse response.
© H. Jleed: 2018 ~
k) The different steps performed in the design of the digital bandpass filter in j) will now be
illustrated. First, design an analog 5th order Chebyshev type I lowpass filter with a passband ripple of
1 dB and a unity passband edge frequency. Plot the frequency response of the filter. Then convert it to
2 2 2
an analog bandpass filter using the s → ss(+ −1 2) = s s + BW0 transformation (lp2bp function). 1, 2are the
2 1
passband edge frequencies of the analog bandpass filter, and they are computed from the edge
frequencies of the desired bandpass digital filter using the bilinear transformation. Plot the frequency
response of the filter. After the analog bandpass filter is designed, convert it to a digital filter using the
bilinear function. Plot the frequency response of the digital filter, and compare it with the response
found in j).
© H. Jleed: 2018 ~
Now Follow these steps to complete all
questions
© H. Jleed: 2018 ~