5
Infinite Impulse Response Filters
159
•
Infinite impulse response filter structures: direct form I, direct form II, cascade,
and parallel
•
Bilinear transformation for filter design
•
Sinusoidal waveform generation using difference equation
•
Filter design and utility packages
•
Programming examples using TMS320C6x and C code
The finite impulse response (FIR) filter discussed in Chapter 4 has no analog coun-
terpart. In this chapter we discuss the infinite impulse response (IIR) filter that
makes use of the vast knowledge already acquired with analog filters. The design
procedure involves the conversion of an analog filter to an equivalent discrete filter
using the bilinear transformation (BLT) technique.As such, the BLT procedure con-
verts a transfer function of an analog filter in the s-domain into an equivalent
discrete-time transfer function in the z-domain.
5.1 INTRODUCTION
Consider a general input–output equation of the form
(5.1)
(5.2)
=
()
+-
()
+-
()
+◊◊◊+ -
()
--
()
--
()
-◊◊◊- -
()
ax n ax n ax n a x n N
by n by n b y n M
N
M
01 2
12
12
12
yn axn k byn j
kj
j
M
k
N
()
=-
()
--
()
==
ÂÂ
10
DSP Applications Using C and the TMS320C6x DSK. Rulph Chassaing
Copyright © 2002 John Wiley & Sons, Inc.
ISBNs: 0-471-20754-3 (Hardback); 0-471-22112-0 (Electronic)
This recursive type of equation represents an infinite impulse response (IIR) filter.
The output depends on the inputs as well as past outputs (with feedback). The
output y(n), at time n, depends not only on the current input x(n), at time n, and
on past inputs x(n - 1), x(n - 2),...,x(n - N), but also on past outputs y(n - 1),
y(n - 2),...,y(n - M).
If we assume all initial conditions to be zero in (5.2), the z-transform of (5.2)
becomes
(5.3)
Let N = M in (5.3); then the transfer function H(z) is
(5.4)
where N(z) and D(z) represent the numerator and denominator polynomial, respec-
tively. Multiplying and dividing by z
N
, H(z) becomes
(5.5)
which is a transfer function with N zeros and N poles. If all the coefficients b
j
in
(5.5) are zero, this transfer function reduces to the transfer function with N poles
at the origin in the z-plane representing the FIR filter discussed in Chapter 4. For
a system to be stable, all the poles must reside inside the unit circle, as discussed in
Chapter 4. Hence, for an IIR filter to be stable, the magnitude of each of its poles
must be less than 1, or:
1. If |P
i
| < 1, then h(n) Æ 0, as n Æ•, yielding a stable system.
2. If |P
i
| > 1, then h(n) Æ•, as n Æ•, yielding an unstable system.
If |P
i
| = 1, the system is marginally stable, yielding an oscillatory response.
Furthermore, multiple-order poles on the unit circle yield an unstable system. Note
again that with all the coefficients b
j
= 0, the system reduces to a nonrecursive and
stable FIR filter.
5.2 IIR FILTER STRUCTURES
There are several structures that can represent an IIR filter, as discussed next.
5.2.1 Direct Form I Structure
With the direct form I structure shown in Figure 5.1, the filter in (5.2) can be real-
ized. There is an implied summer (not shown) in Figure 5.1. For an Nth-order filter,
Hz
az az az a
zbz bz b
C
zz
zp
NN N
N
NN N
N
i
i
i
N
()
=
+ + +◊◊◊+
+ + +◊◊◊+
=
-
-
--
--
=
’
01
1
2
2
1
1
2
2
1
Hz
Yz
Xz
aaz az az
bz b z b z
Nz
Dz
N
N
N
N
()
=
()
()
=
+ + +◊◊◊+
+ + +◊◊◊+
=
()
()
-- -
-- -
01
1
2
2
1
1
2
2
1
YzaXzazXzazXz azXz
bzYz bz Yz b z Yz
N
N
M
M
()
=
()
+
()
+
()
+◊◊◊+
()
-
()
-
()
-◊◊◊-
()
-- -
-- -
01
1
2
2
1
1
2
2
160
Infinite Impulse Response Filters
this structure has 2N delay elements, represented by z
-1
. For example, a second-
order filter with N = 2 will have four delay elements.
5.2.2 Direct Form II Structure
The direct form II structure shown in Figure 5.2 is one of the most commonly used
structures. It requires half as many delay elements as the direct form 1. For example,
a second-order filter requires two delay elements z
-1
, as opposed to four with the
direct form I. To show that (5.2) can be realized with the direct form II, let a delay
variable U(z) be defined as
(5.6)
where D(z) is the denominator polynomial of the transfer function in (5.4). From
(5.4) and (5.6), Y(z) becomes
(5.7)
where N(z) is the numerator polynomial of the transfer function in (5.4). From (5.6)
(5.8)
Xz UzDz Uz bz bz b z
N
N
()
=
() ()
=
()
+ + +◊◊◊+
()
-- -
1
1
1
2
2
Yz
NzXz
Dz
NzUz
Uz a az az a z
N
N
()
=
() ()
()
=
() ()
=
()
+ + +◊◊◊+
()
-- -
01
1
2
2
Uz
Xz
Dz
()
=
()
()
IIR Filter Structures
161
FIGURE 5.1. Direct form I IIR filter structure.
Taking the inverse z-transform of (5.8) yields
(5.9)
Solving for u(n) in (5.9) gives us
(5.10)
Taking the inverse z-transform of (5.7) yields
(5.11)
The direct form II structure can be represented by (5.10) and (5.11). The delay vari-
able u(n) at the middle top of Figure 5.2 satisfies (5.10), and the output y(n) in Figure
5.2 satisfies (5.11).
Equations (5.10) and (5.11) are used to program an IIR filter. Initially, u(n - 1),
u(n - 2),...are set to zero. At time n, a new sample x(n) is acquired, and (5.10) is
used to solve for u(n). The filter’s output at time n then becomes
At time n + 1, a newer sample x(n + 1) is acquired and the delay variables in (5.10)
are updated, or
yn aun
()
=
()
+
0
0
yn aun aun aun a un N
N
()
=
()
+-
()
+-
()
+◊◊◊+ -
()
01 2
12
un xn bun bun b un N
N
()
=
()
--
()
--
()
-◊◊◊- -
()
12
12
xn un bun bun b un N
N
()
=
()
+-
()
+-
()
+◊◊◊+ -
()
12
12
162
Infinite Impulse Response Filters
FIGURE 5.2. Direct form II IIR filter structure.
where u(n - 1) is updated to u(n). From (5.11), the output at time n + 1 is
and so on, for time n + 2, n + 3,...,when for each specific time, a new input sample
is acquired and the delay variables and then the output are calculated using (5.10),
and (5.11), respectively.
5.2.3 Direct Form II Transpose
The direct form II transpose structure is a modified version of the direct form II
and requires the same number of delay elements. The following steps yield a trans-
pose structure from a direct form II version:
1. Reverse the directions of all the branches.
2. Reverse the roles of the input and output (input ´ output).
3. Redraw the structure such that the input node is on the left and the output
node is on the right (as is typically done).
The direct form II transpose structure is shown in Figure 5.3. To verify this, let
u
0
(n) and u
1
(n) be as shown in Figure 5.3. Then, from the transpose structure,
(5.12)
(5.13)
(5.14)
Equation (5.13) becomes, using (5.12) to find u
0
(n - 1),
(5.15)
u n axn byn axn byn
11 1 2 2
11
()
=
()
-
()
+-
()
--
()
[]
yn axn u n
()
=
()
+-
()
01
1
un axn byn un
11 1 0
1
()
=
()
-
()
+-
()
un axn byn
02 2
()
=
()
-
()
yn aun aun+
()
=+
()
+
()
+11 0
01
un xn bun+
()
=+
()
-
()
-11 0
1
IIR Filter Structures
163
FIGURE 5.3. Direct form II transpose IIR filter structure.
Equation (5.14) becomes, using (5.15) to solve for u
1
(n - 1),
(5.16)
which is the same general input–output equation (5.2) for a second-order system.
This transposed structure implements first the zeros and then the poles, whereas the
direct form II structure implements the poles first.
5.2.4 Cascade Structure
The transfer function in (5.5) can be factored as
(5.17)
in terms of first- or second-order transfer functions. The cascade (or series) struc-
ture is shown in Figure 5.4. An overall transfer function can be represented with
cascaded transfer functions. For each section, the direct form II structure or its trans-
pose version can be used. Figure 5.5 shows a fourth-order IIR structure in terms of
two direct form II second-order sections in cascade. The transfer function H(z), in
terms of cascaded second-order transfer functions, can be written as
(5.18)
Hz
aazaz
bz b z
ii i
ii
i
N
()
=
++
++
--
--
=
’
01
1
2
2
1
1
2
2
1
2
1
H z CH z H z H z
r
()
=
() ()
◊◊◊
()
12
yn axn axn byn axn byn
()
=
()
+-
()
--
()
+-
()
--
()
[]
01 1 2 2
11 2 2
164
Infinite Impulse Response Filters
FIGURE 5.4. Cascade form IIR filter structure.
FIGURE 5.5. Fourth-order IIR filter with two direct form II sections in cascade.
where the constant C in (5.17) is incorporated into the coefficients, and each section
is represented by i. For example, N = 4 for a fourth-order transfer function, and
(5.18) becomes
(5.19)
as can be verified in Figure 5.5. From a mathematical standpoint, proper ordering
of the numerator and denominator factors does not affect the output result. How-
ever, from a practical standpoint, proper ordering of each second-order section can
minimize quantization noise [1–5]. Note that the output of the first section, y
1
(n),
becomes the input to the second section. With an intermediate output result stored
in one of the registers, a premature truncation of the intermediate output becomes
negligible. A programming example will illustrate the implementation of an IIR
filter cascaded into second-order direct form II sections.
5.2.5 Parallel Form Structure
The transfer function in (5.5) can be represented as
(5.20)
which can be obtained using a partial fraction expansion (PFE) on (5.5). This par-
allel form structure is shown in Figure 5.6. Each of the transfer functions H
1
(z),
Hz C H z H z H z
r
()
=+
()
+
()
+◊◊◊+
()
12
Hz
aazazaazaz
bz bz bz b z
()
=
++
()
++
()
++
()
++
()
-- --
-- --
01 11
1
21
2
02 12
1
22
2
11
1
21
2
12
1
22
2
11
IIR Filter Structures
165
FIGURE 5.6. Parallel form IIR filter structure.
H
2
(z),...can be either first- or second-order functions. As with the cascade struc-
ture, the parallel form can be efficiently represented in terms of second-order direct
form II structure sections. H(z) can be expressed as
(5.21)
For example, for a fourth-order transfer function, H(z) in (5.21) becomes
(5.22)
This fourth-order parallel structure is represented in terms of two direct form II
sections as shown in Figure 5.7. From Figure 5.7, the output y(n) can be expressed
in terms of the output of each section, or
Hz C
aazaz
bz bz
aazaz
bz bz
()
=+
++
++
+
++
++
--
--
--
--
01 11
1
21
2
11
1
21
2
02 12
1
22
2
12
1
22
2
11
Hz C
aazaz
bz b z
ii i
ii
i
N
()
=+
++
++
--
--
=
Â
01
1
2
2
1
1
2
2
1
2
1
166
Infinite Impulse Response Filters
FIGURE 5.7. Fourth-order IIR filter with two direct form II sections in parallel.
(5.23)
There are other structures, such as the lattice structure, which are useful for appli-
cations in speech and adaptive filtering. Although such a structure is not as com-
putationally efficient as the direct form II or cascade structures, requiring more
multiplication operations, it is less sensitive to quantization effects [6–8]. The quan-
tization error associated with the coefficients of an IIR filter depends on the amount
of shift in the position of its transfer function’s poles and zeros in the complex plane.
This implies that the shift in the position of a particular pole depends on the posi-
tion of all the other poles. To minimize this dependency of poles, an Nth-order IIR
filter is typically implemented as cascaded second-order sections.
5.3 BILINEAR TRANSFORMATION
The bilinear transformation (BLT) is the most commonly used technique for trans-
forming an analog filter into a discrete filter. It provides a one-to-one mapping from
the analog s-plane to the digital z-plane, using
(5.24)
The constant K in (5.24) is commonly chosen as K = 2/T, where T represents a sam-
pling variable. Other values for K can be selected, since it has no consequence in
the design procedure. We choose T = 2 or K = 1 for convenience, to illustrate the
bilinear transformation procedure. Solving for z in (5.24) gives us
(5.25)
This transformation allows the following:
1. The left region in the s-plane, corresponding to s<0, maps inside the unit
circle in the z-plane.
2. The right region in the s-plane, corresponding to s>0, maps outside the unit
circle in the z-plane.
3. The imaginary jw axis in the s-plane maps on the unit circle in the z-plane.
Let w
A
and w
D
represent the analog and digital frequencies, respectively. With
s = jw
A
and z = e
jw
D
T
, (5.24) becomes
z
s
s
=
+
-
1
1
sK
z
z
=
-
+
1
1
y n Cx n y n
i
i
N
()
=
()
+
()
=
Â
1
2
Bilinear Transformation
167