Professional Documents
Culture Documents
1.
2.
3.
1.
NAME OF
INSTRUCTOR(S)
2.
Page 2 of 11
FTK/JTKEK/BETT3373
1.0 OBJECTIVES
Student able:
1. To understand the basic concepts and working principles of the IIR filter
2. To understand the structure of the IIR filter
3. To understand the concepts of certain basic IIR filter design techniques
4. To acquire the capability of designing IIR filters to meet certain filtering requirements
2.0 EQUIPMENT
Hardware Type/Version
1. Workstation (Computer) Windows 7
2. MATLAB R2013
p 0 + p1 z −1 + p1 z −1 + + p M z − M
H (z )IIR = where N = filter order
d 0 + d1 z −1 + d 2 z − 2 + + p N z − N
Step 1. Convert digital filter specifications into analog low pass prototype filter specifications.
Step 2. Determine the analog low pass filter transfer function that meets these specifications.
Step 3. Transform the identified analog low pass filter transfer function into the desired digital
filter transfer function.
Page 3 of 11
FTK/JTKEK/BETT3373
4.0 PROCEDURE
We will design the following IIR filters (with all frequencies and magnitudes specified in normalized
forms).
Filter 1: Low pass filter with a 3-dB cut-off frequency of 0.2, bandstop edge at a frequency of
0.3, passband maximum magnitude deviation of 3 dB, stopband maximum magnitude of –15 dB.
For Step 1 mentioned earlier, we normally apply the bilinear transformation method to convert the
frequency requirements from the z-domain (digital: ) to the s-domain (analog: ). See the
following equations. We can use T=2 in the transformation from the z-domain to the s-domain as
long as the reverse transformation for Step 3 uses the same value of T.
2 1 − z −1
s= (1)
T 1 + z −1
2
= tan (2)
T 2
|H(ej)|
1
1/(1 + 2)0.5
Transition
band
1/A
p s
0
Figure 2 – Filter Magnitude Specifications
Exercises
a. Transform the 3-dB cut-off frequency of 0.2 and bandstop frequency of 0.3 from the
z-domain to the s-domain using the bilinear transformation equations provided earlier.
(Hint: From equation (2), convert p, s → p, s)
Page 4 of 11
FTK/JTKEK/BETT3373
c. Determine the transition ratio, k, and discrimination parameter, k1, of the filter given by the
following equations:
p
k= (3)
s
k1 = (4)
A2 − 1
d. Design a Butterworth filter that meets the filtering requirements set for Filter 1, as
described earlier, using the following equations.
The order of a Butterworth filter is approximated as follows:
log10 (1 / k1 )
N=
log 10 (1 / k )
(5)
%% myLab4_1.m
clear all; close all;
%Passband
ps_nor = 0.2;
ps_ang = pi*ps_nor;
ps_max_dev_dB = -3;
ps_max_dev = 10^(ps_max_dev_dB/20);
%Stopband
sp_nor = 0.3;
sp_ang = pi*sp_nor;
sp_max_mag_dB = -15;
sp_max_mag = 10^(sp_max_mag_dB/20);
Page 5 of 11
FTK/JTKEK/BETT3373
e. Convert the transfer function derived in Exercise (d) into the z-domain using bilinear
transformation. You may need to refer to Equation (1) for the conversion.
(Hint: Ha(s) → Ha(z) )
f. Implement the above Butterworth IIR filter in MATLAB (myLab4_2.m). You may want to
use the built-in buttap function in MATLAB to determine the reference transfer function
for a low pass Butterworth filter with a cut-off angular frequency of 1 rad/s. The adjustment
of s → s / cutoff must be made to the reference transfer function to obtain the filter transfer
function of the desired cut-off frequency. Use the bilinear function in MATLAB for
bilinear transformation.
(Hint: Adjustment of s → s / cutoff )
Page 6 of 11
FTK/JTKEK/BETT3373
g. Build another Butterworth IIR filter with the same order and filtering specifications in the z-
domain using both the butter and buttord functions directly. Understand the coding
and compare the magnitude responses of the two IIR filters. You may refer to Appendix
for more information about the MATLAB functions.
%% IIR low-pass filter based on Butterworth design using Matlab function directly
[N_ord1, Wn1] = buttord(ps_nor, sp_nor, -ps_max_dev_dB, -sp_max_mag_dB);
[b, a] = butter(N_ord1, Wn1);
% Magnitude response
N = 1024;
[H1_b, W1_b] = freqz(b, a, N);
H1_b = H1_b / max(abs(H1_b));
h. Based on previous example, implement the following filters using both the butter and
buttord functions directly. Refer to Appendix for more information about these functions.
|HBP(ej)|
|HHP(ej)| 0 dB
0 dB
-3dB
-3dB
Transition
band
-15 dB -15 dB
(a) (b)
Page 7 of 11
FTK/JTKEK/BETT3373
|HBS(ej)|
0 dB
-3dB
-15 dB
(c)
8.0 CONCLUSION
Page 8 of 11
FTK/JTKEK/BETT3373
Appendix
Butterworth filters are characterized by a magnitude response that is maximally flat in the passband
and monotonic overall. In the low pass case, the first 2n–1 derivatives of the squared magnitude
response are zero at ω = 0. The squared magnitude response function is
1
| H ( ) | 2 =
2n
1+ ( )
0
which corresponds to a transfer function with poles equally spaced around a circle in the left half-
plane. The magnitude response at the cut-off angular frequency ω0 is 1 / 2 , regardless of the filter
order. buttap sets ω0 to 1 for a normalized result.
The syntax for the Butterworth analog low pass filter prototype in MATLAB is as follows:
[z,p,k] = buttap(n)
[z,p,k] = buttap(n) returns the poles and gain of an order n Butterworth analog low pass
filter prototype. The function returns the poles in the length n, column vector p, and gain in scalar
k. z is an empty matrix because there are no zeros. The transfer function is computed as follows:
z ( s) k
H (s) = =
p( s) ( s − p(1))(s − p(2)) ( s − p(n))
Bilinear transformation is a method for analog-to-digital filter conversion. The syntax of bilinear
transformation in MATLAB is as follows:
[numd,dend] = bilinear(num,den,fs)
This syntax will convert an s-domain transfer function given by num and den to a discrete
equivalent. Row vectors num and den specify the coefficients of the numerator and denominator,
respectively, in descending powers of s.
fs is the sampling frequency in hertz. bilinear returns the discrete equivalent in row vectors
numd and dend in descending powers of z (ascending powers of z–1).
Page 9 of 11
FTK/JTKEK/BETT3373
The butter function in MATLAB designs low pass, bandpass, high pass, and bandstop digital
and analog Butterworth filters. Butterworth filters are characterized by a magnitude response that
is maximally flat in the passband and monotonic overall. There is a built-in function in MATLAB
which can be used to build the Butterworth IIR filter directly. The syntax of this function is as
follows:
[b,a] = butter(n,Wn)
[b,a] = butter(n,Wn,'s') designs an order n low pass analog Butterworth filter with
angular cut-off frequency Wn rad/s. It returns the filter coefficients in the length n+1, row vectors b
and a, in descending powers of s, derived from the transfer function as follows:
For digital filter design, butter uses bilinear to convert the analog filter into a digital filter
through a bilinear transformation with frequency prewarping. Careful frequency adjustment
guarantees that the analog filters and the digital filters will have the same frequency response
magnitude at Wn, or w1 and w2.
The MATLAB function of buttord calculates the minimum order of a digital or analog
Butterworth filter required to meet a set of filter design specifications. The syntax of this function
in MATLAB is as follows:
[n,Wn] = buttord(Wp,Ws,Rp,Rs,'s')
[n,Wn] = buttord(Wp,Ws,Rp,Rs) returns the lowest order, n, of the digital Butterworth filter
that loses no more than Rp dB in the passband and has at least Rs dB of attenuation in the
stopband. The scalar (or vector) of corresponding cut-off frequencies, Wn, is also returned. Use
the output arguments n and Wn in butter. Wp and Ws are the normalized passband and
stopband frequencies respectively.
One of the frequency transformation functions in MATLAB is lp2hp. It transforms analog low
pass filter prototypes with a cut-off angular frequency of 1 rad/s into high pass filters with the
desired cut-off angular frequency. The transformation can be done in the following syntax in
MATLAB:
[bt,at] = lp2hp(b,a,Wo)
Scalar Wo specifies the cut-off angular frequency in unit of radians/second. The frequency
transformed filter is returned in row vectors bt and at.
Page 10 of 11
FTK/JTKEK/BETT3373
lp2bp transforms analog low pass filter prototypes with a cut-off angular frequency of 1 rad/s into
bandpass filters with the desired bandwidth and center frequency. It is one of the frequency
transformation functions where its syntax in MATLAB is as follows:
[bt,at] = lp2bp(b,a,Wo,Bw)
This function transforms an analog low pass filter prototype given by polynomial coefficients into a
bandpass filter with center frequency Wo and bandwidth Bw. Row vectors b and a specify the
coefficients of the numerator and denominator of the prototype in descending powers of s.
Scalars Wo and Bw specify the center frequency and bandwidth in unit of rad/s. For a filter with
lower band edge w1 and upper band edge w2, use Wo = sqrt(w1*w2) and Bw = w2-w1.
lp2bp returns the frequency transformed filter in row vectors bt and at.
[bt,at] = lp2bs(b,a,Wo,Bw)
Scalars Wo and Bw specify the center frequency and bandwidth in unit of radians/second. For a
filter with lower band edge w1 and upper band edge w2, use Wo = sqrt(w1*w2) and
Bw = w2–w1. lp2bs returns the frequency transformed filter in row vectors bt and at.
Page 11 of 11