0% found this document useful (0 votes)
68 views8 pages

LAB 11 - Design of Discrete-Time IIR Filters - I

This document describes designing discrete-time IIR filters based on analog lowpass Butterworth prototype filters. It provides the characteristics and design equations for Butterworth filters, including that the poles are uniformly distributed on a circle in the s-plane. The tasks involve designing a Butterworth filter to given specifications, plotting the pole locations, and computing the magnitude-squared response. MATLAB functions are provided to design the filter and compute its response, and the tasks require calling these functions for a given design problem and verifying the results.

Uploaded by

M Hassan Bashir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views8 pages

LAB 11 - Design of Discrete-Time IIR Filters - I

This document describes designing discrete-time IIR filters based on analog lowpass Butterworth prototype filters. It provides the characteristics and design equations for Butterworth filters, including that the poles are uniformly distributed on a circle in the s-plane. The tasks involve designing a Butterworth filter to given specifications, plotting the pole locations, and computing the magnitude-squared response. MATLAB functions are provided to design the filter and compute its response, and the tasks require calling these functions for a given design problem and verifying the results.

Uploaded by

M Hassan Bashir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Regd. No.

: _____________________ Name: _____________________ Section: _____________________

LAB 11

Design of Discrete-Time IIR Filters – I

Instructions:

• All tasks must be completed in this lab session for full credit.
• Students must show the output and MATLAB code for each task to the instructor
before proceeding to the next task.

References:

1. Digital Signal Processing using MATLAB: A problem solving companion, Vinay K.


Ingle and John G. Proakis, 4th Edition, Cengage Learning, 2016
2. Discrete Time Signal Processing, Alan. V. Oppenheim and Ronald. W. Schafer, 3rd
Edition, Prentice Hall, 2010
3. Digital Signal Processing: Principles, Algorithms, and Applications, John G.
Proakis and Dimitris G. Manolakis, 4th Edition, Prentice Hall, 2007

1. CHARACTERISTICS OF PROTOTYPE ANALOG FILTERS


IIR filter design techniques rely on existing analog filters to obtain discrete-time filters. These analog filters as
termed as prototype filters. Three prototype filters are widely used in practice, namely Butterworth lowpass,
Chebyshev lowpass (Type I and II), and Elliptic lowpass. In this lab session, we will discuss Butterworth filter
in detail.

1.1 BUTTERWORTH LOWPASS FILTERS


This filter is characterized by the property that its magnitude response is flat in both passband and stopband.
The magnitude-squared response of an 𝑁th-order Butterworth lowpass filter is given by

1
|𝐻(Ω)|2 = , (1)
Ω 2𝑁
1 + (Ω )
𝑐

where 𝑁 is the order of the filter and Ω𝑐 is the cutoff frequency, i.e., the frequency at which the magnitude-
squared response drops by 50% of its zero-frequency value, which is 1. The plot of the magnitude-squared
response of the Butterworth lowpass filter is shown in Figure 1, from which we observe that:

1. |𝐻(Ω)|2 = |𝐻(Ω)| = 1 for all values of the order 𝑁,


2. |𝐻(Ω𝑐 )| = 0.5 for all 𝑁, which implies a 3 dB attenuation at Ω𝑐 .
3. |𝐻(Ω)|2 is a monotonically decreasing function of Ω.
4. |𝐻(Ω)|2 approaches an ideal lowpass filter as 𝑁 approaches infinity.
5. |𝐻(Ω)|2 is maximally flat at Ω = 0.

Figure 1: Magnitude-squared response of Butterworth lowpass filter for different orders.

The system function is obtained by noting that 𝐻(−Ω) = 𝐻(Ω)∗ for real-valued impulse response ℎ(𝑡). Hence,

1
𝐻(𝑠)𝐻(−𝑠) = 𝑁 |𝑠=𝑗Ω = |𝐻(Ω)|2 . (2)
−𝑠 2
1 + ( 2)
Ω𝑐

The poles of the filter are now obtained from the roots of the denominator in (2) as
𝜋 𝜋
𝑝𝑘 = ±Ω𝑐 𝑒 𝑗 2 𝑒 𝑗(2𝑘+1)2𝑁 , 𝑘 = 0, 1, … , 𝑁 − 1. (3)

From (3), we observe that:

1. A Butterworth lowpass filter of order 𝑁 has 2𝑁 poles, which are uniformly distributed on a circle of
radius Ω𝑐 with an angular spacing of 𝜋/𝑁 radians.
2. All poles are symmetrically located with respect to the 𝑗Ω axis.
3. A pole never falls on the 𝑗Ω axis and falls on the real axis only if 𝑁 is odd.

We may associate poles in the left-half 𝑠-plane with 𝐻(𝑠) and those in the right-half 𝑠-plane others with 𝐻(−𝑠).

2
The expression in (2) can then be rewritten as

Ω𝑐 2𝑁 Ω𝑐 2𝑁
𝐻(𝑠)𝐻(−𝑠) = = , (4)
Ω𝑐 2𝑁 + (−𝑠 2 )𝑁 ∏𝑁−1
𝑘=0 (𝑠 − 𝑝𝑘 )(𝑠 + 𝑝𝑘 )

from which, we can write the system function of causal, stable and lowpass Butterworth filter as

Ω𝑐 𝑁
𝐻(𝑠) = 𝑁−1 , (5)
∏𝑘=0 (𝑠 − 𝑝𝑘 )
𝜋 𝜋
where 𝑝𝑘 = Ω𝑐 𝑒 𝑗 2 𝑒 𝑗(2𝑘+1)2𝑁 are the locations of the poles in the left half of the 𝑠-plane.

1.1.1 DESIGN EQUATIONS

The analog lowpass filter is specified by the parameters Ω𝑝 , 𝑅𝑝 , Ω𝑠 , and 𝛿𝑠 2 . Therefore, the essence of the
design in the case of Butterworth filter is to obtain the order 𝑁 and the cutoff frequency Ω𝑐 , given these
specifications. The frequency Ω𝑝 is called the passband edge frequency at which the magnitude-squared
response has a value of passband ripple 𝑅𝑝 , i.e.,

1
𝑅𝑝 = −10 log10 . (6)
Ω𝑝 2𝑁
1 + (Ω )
( 𝑐 )

Furthermore, Ω𝑠 is the stopband edge frequency at which the magnitude-squared response has a value of
stopband ripple 𝛿𝑠 2 , i.e.,

1
𝛿𝑠 2 = −10 log10 ( ). (7)
Ω 2𝑁
1 + (Ω𝑠 )
𝑐

Solving these two equations for 𝑁 and Ω𝑐 , we get

(10𝑅𝑝 /10 − 1)
log10 ( ⁄ 𝛿 2 /10 )
⌈ (10 𝑠 − 1) ⌉
𝑁=⌈ ⌉, (8)
Ω
⌈ 2 log10 ( 𝑝⁄Ω ) ⌉
𝑠
⌈ ⌉

where integer ceiling function is used to get integer value for 𝑁. Since the actual 𝑁 chosen is larger than
required, specifications can be either met or exceeded either at Ω𝑝 or at Ω𝑠 .

To satisfy the specifications exactly at Ω𝑝 ,

3
Ω𝑝
Ω𝑐 = , (9)
2𝑁 𝑅𝑝
√(10 10 − 1)

or, to satisfy the specifications exactly at Ω𝑠 ,

Ω𝑠
Ω𝑐 = . (10)
2𝑁 𝛿𝑠 2
√(10 10 − 1)

1.1.2 MATLAB IMPLEMENTATION

MATLAB provides a function called [z,p,k]=buttap (N) to design a normalized (i.e., Ω𝑐 = 1) analog
Butterworth lowpass prototype filter of order N, which returns zeros in z array, poles in p array, and the value of
gain in k. However, we need an unnormalized Butterworth filter with arbitrary Ω𝑐 . From (5), we observe that
there are no zeros and that the poles of the unnormalized filter are on a circle with radius Ω𝑐 instead of on a unit
circle. This means that we have to scale the array p of the normalized filter by Ω𝑐 and the gain k by Ω𝑐 𝑁 . In the
following function, called u_buttap (N, Omegac), we design the unnormalized Butterworth analog prototype
filter.

function [b, a] = u_buttap(N, Omegac)


% Unnormalized Butterworth analog lowpass filter prototype
% --------------------------------------------------------
% [b, a] = u_buttap(N, Omegac)
% b = Numerator polynomial coefficients of H(s)
% a = Denominator polynomial coefficients of H(s)
% N = Order of the Butterworth filter
% Omegac = Cutoff frequency in radians/sec
%
[z, p, k] = buttap(N);
p = p*Omegac;
k = k*Omegac^N;
B = real(poly(z));
b0 = k; b = k*B; a = real(poly(p));

Task 1

1. Design a lowpass analog Butterworth filter with Ω𝑝 = 1000 KHz, Ω𝑠 = 2000 KHz, passband ripple
𝑅𝑝 = 5 dBs and a stopband ripple of 𝛿𝑠 2 = 40 dBs. Find the cutoff freqeuency so that the
specifications are met exactly at Ω𝑝 . Show your work in the space below.
2. Also complete the MATLAB function [N, Omegac] = butterap_design (Omegap, Omegas, Rp, dS_sq)
to design the filter with above mentioned specifications.
3. Write a MATLAB script to plot the poles, obtained from the function above. Also, plot a circle of radius
Ω𝑐 on the same figure to verify that the poles indeed lie on this circle.

4
4. Complete the MATLAB function Hsq = butterap_msr (N, Omegac) given below to compute the
magnitude-squared response of the lowpass Butterworth filter. Then, write a separate script file to call
the function for the specifications mentioned above.

function [N, Omegac] = butterap_design(Omegap, Omegas, Rp, dS_sq)


% Magnitude-squared response of analog Butterworth lowpass filter
% ---------------------------------------------------------------
% [N, Omegac] = butterap_design (Omegap, Omegas, Rp, dS_sq)
% N = Order of the Butterworth filter
% Omegac = Cutoff frequency of the Butterworth filter
% Omegap = Passband edge frequency of the Butterworth filter
% Omegas = Stopband edge frequency of the Butterworth filter
% Rp = Passband ripple
% dS_sq = Stopband ripple
% ---------------------------------------------------------------
% Write your code here.
% ---------------------------------------------------------------

function Hsq = butterap_msr(N, Omegac)


% Magnitude-squared response of analog Butterworth lowpass filter
% ---------------------------------------------------------------
% Hsq = u_buttap(N, Omegac)
% Hsq = Magnitude-squared response of the filter
% N = Order of the Butterworth filter
% Omegac = Cutoff frequency in radians/sec
% ---------------------------------------------------------------
% Write your code here.
% ---------------------------------------------------------------

Task 2
A method to display the frequency-domain plots of analog filter is provided by the function freqs_m, given
below, which is a modified version of a function freqs provided by MATLAB. This function computes the
magnitude response in absolute as well as in relative dB scale and the phase response.

5
function [db, mag, pha, w] = freqs_m(b, a, wmax)
% Computation of s-domain frequency response: Modified version
% ------------------------------------------------------------
% [db, mag, pha, w] = freqs_m(b, a, wmax)
% db = Relative magnitude in db over the interval [0 to wmax]
% mag = Absolute magnitude over the interval [0 to wmax]
% pha = Phase response in radians over the interval [0 to wmax]
% w = Array of 500 frequency samples between 0 and wmax
% b = Numerator polynomial coefficents of H(s)
% a = Denominator polynomial coefficents of H(s)
% wmax = Maximum frequency in rad/sec over which response is
desired
%
w = (0:1:500)*wmax/500;
H = freqs(b, a, w);
mag = abs(H);
db = 10*log10((mag+eps)/max(mag));
pha = angle(H);

• Call the above function in a script file to plot the absolute and dB magnitude response along with the
phase response of the lowpass Butterworth filter designed in Task 1.

2. DISCRETE-TIME IIR FILTERS

Discrete-time IIR filters are obtained by mapping the system function of the analog filter, i.e., 𝐻(𝑠), to the
system function of the discrete-time filter, 𝐻(𝑧), by mapping the points in the 𝑠-plane to the 𝑧-plane. Different
transformation methods exist in this regard, namely
1. Approximation of derivatives
2. Impulse Invariance
3. Bilinear Transformation
4. Matched 𝑧-Transformation
However, we will discuss bilinear transformation only.

2.1 BILINEAR TRANSFORMATION

Bilinear transformation maps the points in the 𝑠-plane to the 𝑧-plane via

2 1 − 𝑧 −1
𝑠= , (11)
𝑇 1 + 𝑧 −1

which can be rearranged to write

6
1 + 𝑠𝑇⁄2
𝑧= , (12)
1 − 𝑠𝑇⁄2

where the sampling time 𝑇 is an arbitrary parameter. Using 𝑠 = 𝜎 + 𝑗𝛺, and 𝑧 = 𝑟𝑒 𝑗𝜔 , we can write

2 𝑧 − 1 2 𝑟𝑒 𝑗𝜔 − 1 2 𝑟2 − 1 2𝑟 sin 𝜔
𝑠= = 𝑗𝜔
= ( 2
+𝑗 )
𝑇 𝑧 + 1 𝑇 𝑟𝑒 + 1 𝑇 1 + 𝑟 + 2𝑟 cos 𝜔 1 + 𝑟 2 + 2𝑟 cos 𝜔

from which we obtain

2 𝑟2 − 1 2 2𝑟 sin 𝜔
𝜎= , 𝛺= . (13)
𝑇 1 + 𝑟 2 + 2𝑟 cos 𝜔 𝑇 1 + 𝑟 2 + 2𝑟 cos 𝜔
We note that if 𝑟 < 1, 𝑟 = 0 or 𝑟 > 1, then 𝜎 < 0, 𝜎 = 0 and 𝜎 > 0 respectively. Consequently, the left half of
𝑠-plane is mapped to inside the unit circle in the 𝑧-plane, the imaginary 𝑗𝛺 axis is mapped onto the unit circle
and the right half of 𝑠-plane is mapped outside the unit circle in the 𝑧-plane. Hence, causal and stable analog
filter is transformed into a causal and stable discrete-time filter.

Substituting 𝑟 = 1 in (13), we obtain

2 sin 𝜔 2 𝜔
𝛺= = tan . (14)
𝑇 1 + cos 𝜔 𝑇 2

This shows that although there is a unique mapping from 𝛺 to 𝜔, which eliminates aliasing, 𝛺 is nonlinearly
related to 𝜔. This phenomenon is termed as frequency compression or frequency warping, because high analog
frequencies are mapped to a very small range of discrete high frequencies.

2.1.1 DESIGN PROCEDURE


Given discrete-time filter specifications 𝜔𝑝 , 𝜔𝑠 , 𝑅𝑝 and 𝛿𝑠 2 , we want to determine 𝐻(𝑧). The design steps in
this procedure are the following.

1. Choose a value for 𝑇. This is arbitrary, and we may set 𝑇 = 1.


2. Prewarp the cutoff frequencies 𝜔𝑝 and 𝜔𝑠 , i.e., calculate Ω𝑝 and Ω𝑠 using (14):
2 𝜔𝑝
Ω𝑝 = tan ,
𝑇 2
2 𝜔𝑠
Ω𝑠 = tan .
𝑇 2
3. Design an analog filter 𝐻(𝑠) to meet the specifications Ω𝑝 , Ω𝑠 , 𝑅𝑝 , and 𝛿𝑠 2 . This has already been
described (for Butterworth filter) in the previous section.
4. Finally, obtain the system function for the discrete-time filter as

2 1 − 𝑧 −1
𝐻(𝑧) = 𝐻 ( ) (15)
𝑇 1 + 𝑧 −1

and simplify to obtain 𝐻(𝑧) as a rational function of 𝑧 −1 .

7
2.1.2 MATLAB IMPLEMENTATION
MATLAB provides a function called [b_d, a_d] = bilinear (b, a, Fs) to implement this mapping. b and a are the
direct-form coefficients of 𝐻(𝑠), Fs=1/T, and b_d, a_d are the direct-form coefficients of 𝐻(𝑧). The function
takes other several forms for different input-output quantities.

Task 3
Design, by hand, a discrete-time Butterworth filter with the following specifications:
𝜔𝑝 = 0.3𝜋, 𝜔𝑠 = 0.5𝜋, 𝑅𝑝 = 1 dB and 𝛿𝑠 2 = 20 dBs.
Show your working in the space below.

1. Following the design procedure listed in Section 2.1.1, and using the MATLAB functions
butterap_design, u_buttap and bilinear, design the discrete-time lowpass Butterworth filter, for
specifications given in Task 3, in MATLAB, i.e., compute its direct-form coefficients.
2. Use the function freqs_m to plot the absolute and dB magnitude responses along with the phase
response of the filter.

You might also like