You are on page 1of 54

Digital Signal Processing

1
Chapter 6
IIR Filter
Introduction
2
oDigital filters are widely used in almost all areas
of DSP.
oIf linear phase is not critical, infinite impulse
response (IIR) filters yield a much smaller filter
order for a given application.
oDigital filters process discrete-time signals.
3
Low & constantly
decreasing cost
Freedom from
component
variations
Easy modification
of filter
characteristics
High accuracy
High noise
immunity
Advantages
4
o Digital filters are therefore rapidly replacing
analog filters in many applications.
o Digital filtering is not only as a smoothing or
averaging operation, but also as any processing
of the input signal.
Techniques of Digital Filter Design
5
oDigital filter design revolves around 2 different
approaches.
oIf linear phase is not critical, IIR filters yield a
much smaller filter order.
oThe design starts with an analog lowpass
prototype based on the given specifications.
oIt is then converted to the required digital filter,
by using appropriate mapping and spectral
transformation.
6
oA causal, stable IIR filter can never display
linear phase for several reasons.
oThe transfer function of a linear-phase filter must
correspond to a symmetric sequence and ensure
that
H(z) = H(-1/z)

oFor every pole inside the unit circle, there is a
reciprocal pole outside the unit circle.
oThis makes the system unstable (if causal) or
noncausal (if stable).
7
oTo make the infinitely long symmetric impulse
response sequence of an IIR filter causal, we need
an infinite delay.

oSymmetric truncation (to preserve linear phase)
simply transforms the IIR filter into an FIR filter.

oOnly FIR filters can be designed with linear
phase (no phase distortion).
8
oTheir design is typically based on selecting a
symmetric impulse response sequence whose
length is chosen to meet design specifications.

oThis choice is often based on iterative techniques
(trial & error).

oFor given specifications, FIR filters require
many more elements in their realization than do
IIR filters.
IIR Filter Design
9
oThere are 2 related approaches:

Using the well-established analog filter design,
followed by a mapping that converts the analog
filter to the digital filter.

Directly designing the digital filter using
digital equivalents of analog approximations.
Equivalence of Analog & Digital Systems
10
oThe impulse response h(t) of an analog system
may be approximated by



ot
s
is the sampling interval corresponding to the
sampling rate S = 1/t
s
.
oThe discrete-time impulse response h
s
[n]
describes the samples h(nt
s
) of h(t):
( ) ( ) ( ) ( ) ( ) ( )
s
n
s s s
n
s a
nt t nt h t nt t t h t t h t h = = ~


=

=
o o
~
| | ( ) | | | | k n k h nt h n h
k
s s s
= =

=
o
11
oThe Laplace transform H
a
(s) of is given by


oThe z-transform H
d
(z) of h
s
[n] is given by


oComparison suggests the equivalence
H
a
(s) = t
s
H
d
(z) provided z
-k
= , or



( ) ( ) ( )

= ~
k
skt
s s a
s
e kt h t s H s H
( ) | |
k
k
s d
z k h z H

=
s
skt
e

s
st
e z =
( )
s
t
z
s
ln
=
12
oThese relations describe a mapping between the
variables z and s.
oSince s = + j, where is the continuous
frequency, the complex variable z can be
expressed as



where is the digital

frequency in radians/sample.
( ) O +
= = =
j t t j t t j
e e e e e z
s s s s
o e o e o
F
S
f
t
s
t
t
e 2
2
= = = O
Response Matching
13
oThe idea of response matching is to match the
time-domain analog & digital response.
oTypically the impulse response or step response.
oGiven the analog filter H(s) & the input x(t)
whose invariance we seek, first find the analog
response y(t) as the inverse transform of H(s)X(s).
ox(t) & y(t) are then sampled at intervals t
s
to
obtain their sampled versions x[n] & y[n].
oFinally, H(z) = Y(z)/X(z) is computed to obtain
the digital filter.
14
+The concept of response invariance:






+The quality of the approximation depends on the
choice of the sampling interval t
s
& a unique
correspondence is possible only if the sampling
rate S = 1/t
s
is above Nyquist rate (avoid aliasing).
15
oThis mapping is thus useful only for analog
systems such as lowpass & bandpass filters,
whose frequency response is essentially band-
limited.
oThe analog transfer function H(s) must be
strictly proper (with numerator degree less than
the denominator degree).
oThe response y(t) of H(s) matches the response
y[n] of H(z) at the sampling instants t = nt
s
.
16
+ Example 6.1
+ Convert to H(z) by using:

I) Impulse invariance transformation.
II) Step invariance transformation.

Solution
I) Choose x(t) = (t). Then, X(s) = 1.
( )
( )( ) 2 1
4
+ +
=
s s
s H
( ) ( ) ( )
( )( ) 2
4
1
4
2 1
4
+

+
=
+ +
= =
s s s s
s X s H s Y
17
+Taking the inverse Laplace Transform,


+The sampled input and output are given by
x[n] = [n]


Their z-Transform gives
X(z) = 1
( ) ( ) ( ) t u e t u e t y
t t 2
4 4

=
| | | | | | n u e n u e n y
s s
nt nt 2
4 4

=
( )
s s
t t
e z
z
e z
z
z Y
2
4 4

=
18
+ The ratio of their z-Transform gives the transfer
function of the digital filter,




II) Choose x(t) = u(t). Then, X(s) = 1/s.
( )
( )
( )
( )
s s
t t
I
e z
z
e z
z
z Y
z X
z Y
z H
2
4 4

= = =
( ) ( ) ( )
( )( ) 2
2
1
4 2
2 1
4
+
+
+
=
+ +
= =
s s s s s s
s X s H s Y
19
+Taking the inverse Laplace Transform,


+The sampled input and output are given by
x[n] = u[n]

( ) ( ) ( ) ( ) t u e t u e t u t y
t t 2
2 4 2

+ =
| | | | | | | | n u e n u e n u n y
s s
nt nt 2
2 4 2

+ =
20
+Their z-Transform gives





+The ratio of their z-Transform gives the transfer
function of the digital filter,
( )
1
=
z
z
z X
( )
s s
t t
e z
z
e z
z
z
z
z Y
2
2 4
1
2

=
( )
( )
( )
( ) ( )
s s
t t
S
e z
z
e z
z
z X
z Y
z H
2
1 2 1 4
2


= =
The Bilinear Transformation
21
oThe bilinear transformation is defined by


o (6.9)
where C = 2/t
s
oBy letting = 0, the complex variable z is
obtained in the form




1
1
+

=
z
z
C s
s C
s C
z

+
=
( ) C j
e
j C
j C
z
e
e
e
1
tan 2

=

+
=
22
oSince z = e
j
, where = 2tF is the digital
frequency, then

(6.12)

oThis is a non-linear relation between the analog
frequency & the digital frequency .
oWhen = 0, = 0 & , t.
oIt is a one-to-one mapping that nonlinearly
compresses analog frequency range - < f < to
the digital frequency range -t < < t.
|
.
|

\
|
= O

C
e
1
tan 2 ( ) O = 5 . 0 tan C e
23
+It avoids the effect of aliasing at the expense of
distorting, compressing or warping the analog
frequencies as shown:
24
oThe higher the frequency, the more severe is the
warping.

oWarping can be compensated but cannot be
eliminated!

oWarping can be compensated if the frequency
specifications is prewarped before designing the
analog system H(s) or by applying bilinear
transformation.
25
Graph of versus for different values of C
compared to the linear relation = .
26
oThe analog & digital frequencies always show a
match at the origin & at one other value dictated
by the choice of C.

oThe advantages of bilinear transformation are:
1.simple
2.stable
3.one-to-one mapping.

o It avoids problems caused by aliasing & hence
can be used for HP & BS filters.
Using Bilinear Transformation
27
oGiven an analog transfer function H(s) whose
response at analog frequency
A
is to be matched
to H(z) at the digital frequency
D
, we can design
H(z) in one of 2 ways:
1)Take C by matching
A
& the prewarped
frequency
D
, & obtain H(z) from H(s) using the
Equation 6.9. From Equation 6.12,
( )
D A
C O = 5 . 0 tan e
( )
D
A
C
O
=
5 . 0 tan
e
( ) ( )
( ) ( ) 1 1 + =
=
z z C s
s H z H
28
2)Take a convenient value for C, (say C = 1). This
matches the response at prewarped frequency
x

given by

H(s) is frequency scaled to H
1
(s) = H(s
A
/
x
),
& then H(z) is obtained from H
1
(s) using the
transformation s = (z - 1)/(z + 1), where C = 1.
( )
D x
O = 5 . 0 tan e
( ) ( )
x A
s s
s H s H
e e /
1
=
=
( ) ( )
( ) ( ) 1 1
1
+ =
=
z z s
s H z H
29
+Example 6.2
Consider a Bessel filter described by


Design a digital filter whose magnitude at f
0
= 3
kHz equals the magnitude of H(s) at
A
= 4 rad/s
if the sampling rate S = 12 kHz.

The digital frequency is given by = 2tf
0
/S =
0.5t.
( )
3 3
3
2
+ +
=
s s
s H
30
+Solution
We can solve the problem by using either one of
the two methods discussed earlier:
+Method 1
C is selected by choosing the prewarped
frequency equal to
A
= 4 rad/s.

A
= 4 = Ctan(0.5)
( ) ( ) ( )
4
5 . 0 5 . 0 tan
4
5 . 0 tan
4
= =
O
=
t
C
31
+H(s) is transformed to H(z) using
( )
1
1 4
1
1
+

=
+

=
z
z
z
z
C s
( ) ( )
( ) ( ) 1 1 4 +
=
z z
s H z H
( )
( ) ( ) ( )
( )
3
1
12 12
1
1 2 16
3
3
1
1 4
3
1
1 4
3
2
2
2
+
|
.
|

\
|
+

+
|
|
.
|

\
|
+
+
=
+
|
.
|

\
|
+

+
|
.
|

\
|
+

=
z
z
z
z z
z
z
z
z
z H
( )
( )
7 26 31
1 3
2
2
+
+
=
z z
z
z H
32
+Method 2
Choose C = 1.


Then, H(s) is frequency scaled to

H
1
(s) = H(s
A
/
x
) = H(s(4/1)) = H(4s)
( ) ( ) ( ) 1 5 . 0 5 . 0 tan 5 . 0 tan = = O = t e
D x
( )
( ) ( )
3 12 16
3
3 4 3 4
3
2 2
1
+ +
=
+ +
=
s s
s s
s H
33
+H(z) is obtained from H
1
(s) using the
transformation s = (z - 1)/(z + 1):
( ) ( )
( ) ( ) 1 1
1
+ =
=
z z s
s H z H
( )
( )
3
1
12 12
1
16 32 16
3
3
1
1
12
1
1
16
3
2
2
2
+
|
.
|

\
|
+

+
|
|
.
|

\
|
+
+
=
+
|
.
|

\
|
+

+
|
.
|

\
|
+

=
z
z
z
z z
z
z
z
z
z H
( )
( )
7 26 31
1 3
2
2
+
+
=
z z
z
z H
34
+The magnitude of ,H(s), = at s = j = j4 matches
the magnitude of ,H(z), at z = e
j
= e
jt/2
= j.
( )
3 3
3
2
+ +
=
s s
s H
( )
( ) ( )
12 13
3
3 12 16
3
3 4 3 4
3
2
4
j j
j j
s H
j s
+
=
+ +
=
+ +
=
=
( )
|
.
|

\
|

=
+

=
|
|
.
|

\
|


+
=
=
313
36
313
39
144 169
36 39
12 13
12 13
12 13
3
4
j j
j
j
j
s H
j s
( ) 1695 . 0
313
36
313
39
2 2
4
=
|
.
|

\
|

+
|
.
|

\
|

=
= j s
s H
35
( )
( )
7 26 31
1 3
2
2
+
+
=
z z
z
z H
( ) 1695 . 0
1252
144
1252
156
2 2
=
|
.
|

\
|

+
|
.
|

\
|

=
= j z
z H
Spectral Transformations for IIR
Filters
36
oAs with analog filters, the design of IIR filters
usually starts with analog LP prototype, which is
converted to digital LP prototype by appropriate
mapping & transformed to the required filter type
by appropriate spectral transformation.

oFor bilinear mapping, we can perform the
mapping & spectral transformation (in a single
step) on the analog prototype itself.
Digital-to-Digital Transformations
37
oIf a digital LP prototype has been designed, the
digital-to-digital transformations of Table 6.1 can
be used to convert it to the required filter.
oThe LP to BP transformations & LP to BS
transformations yield a digital filter with twice the
order of the LP prototype.
oThe LP to LP transformation is actually a special
case of the more general allpass transformation.
oThe digital LP prototype cutoff frequency is
D
.
Digital-to-Digital Transformations
38
Form Band Edges Mapping s Parameters
LP to LP
C

LP to HP
C

LP to BP [
1
,
2
]
LP to BS [
1
,
2
]
K = tan(0.5
D
)tan[0.5(
2
-
1
)]
z
z
o
o

1
( ) | |
( ) | |
C D
C D
O + O
O O
=
5 . 0 sin
5 . 0 sin
o
( )
z
z
o
o
+
+
1
( ) | |
( ) | |
C D
C D
O O
O + O
=
5 . 0 cos
5 . 0 cos
o
( )
1
1
2
2
2 1
2
+ +
+ +
z A z A
A z A z
( )
( ) | |
1 2
5 . 0 tan
5 . 0 tan
O O
O
=
D
K
( ) | |
( ) | |
1 2
1 2
5 . 0 cos
5 . 0 cos
O O
O + O
= o
1
2
1
+
=
K
K
A
o
1
1
2
+

=
K
K
A
( )
1
1
2
2
2 1
2
+ +
+ +
z A z A
A z A z
( ) | |
( ) | |
1 2
1 2
5 . 0 cos
5 . 0 cos
O O
O + O
= o
1
2
1
+
=
K
A
o
K
K
A
+

=
1
1
2
39
oAll digital frequencies are normalized to
= 2tf/S

+Example 6.3
A LP filter operates at S = 8 kHz. Its cutoff
frequency is 2 kHz. Use H(z) to design a HP filter
with a cutoff frequency of 1 kHz.
Solution

D
= 2tf
C
/S = 2t(2)/8 = 0.5t

C
= 2tf
C
/S = 2t(1)/8 = 0.25t
40
Spectral transformation:
( ) | |
( ) | |
( )
( )
4142 . 0
125 . 0 cos
375 . 0 cos
5 . 0 cos
5 . 0 cos
= =
O O
O + O
=
t
t
o
C D
C D
( ) ( )
z
z
z
z
z
z
z
4142 . 0 1
4142 . 0
4142 . 0 1
4142 . 0
1

=


=
+
+

o
o
( )
( )
7
4142 . 0 1
4142 . 0
26
4142 . 0 1
4142 . 0
31
1
4142 . 0 1
4142 . 0
3
7 26 31
1 3
2
2
2
2
+
|
.
|

\
|

|
.
|

\
|


|
.
|

\
|
+


=
+
+
=
z
z
z
z
z
z
z z
z
z H
HP
( )
( )
0723 . 0 0476 . 0
1 28 . 0
2
2
+

=
z z
z
z H
HP
41
+Example 6.4
A lowpass filter operates at

S = 8 kHz. Its cutoff frequency is 2 kHz. Use H(z)
to design a bandpass filter with band edges of 1
kHz & 3 kHz.
Solution

D
= 2tf
C
/S = 2t(2)/8 = 0.5t

1
= 2tf
C
/S = 2t(1)/8 = 0.25t

2
= 2tf
C
/S = 2t(3)/8 = 0.75t

2
-
1
= 0.5t

2
+
1
= t
( )
( )
7 26 31
1 3
2
2
+
+
=
z z
z
z H
42
A
1
= 0, A
2
= 0
Spectral transformation:
( )
( ) | |
( )
( )
1
25 . 0 tan
25 . 0 tan
5 . 0 tan
5 . 0 tan
1 2
= =
O O
O
=
t
t
D
K
( ) | |
( ) | |
( )
( )
0
25 . 0 cos
5 . 0 cos
5 . 0 cos
5 . 0 cos
1 2
1 2
= =
O O
O + O
=
t
t
o
( )
2
2
1
2
2
2 1
2
1 1
z
z
z A z A
A z A z
z =

=
+ +
+ +

( )
( ) ( ) ( )( ) | | ( )
7 26 31
1 3
7 26 31
1 1 3
7 26 31
1 3
7 26 31
1 3
2 4
2
2
2 4
2
2
2 4
2
2
2
2
+ +

=
+ +

=
+ +
+
=
+
+
=
z z
z
z z
z
z z
z
z z
z
z H
BP
Direct Analog-to-Digital Transformations
for Bilinear Design
43
oAll stable transformations are free of aliasing &
introduce warping effects.
oOnly bilinear mapping offers a simple relation to
compensate for the warping.
oTable 6.2 shows the analog-to-digital
transformations of for bilinear design.
oThese can be used to convert a prewarped analog
lowpass prototype (with a cutoff frequency of 1
rad/s) directly to the required digital filter.
44
Form Band Edges Mapping s Parameters
LP to
LP

C
C = tan(0.5
C
)
LP to
HP

C
C = tan(0.5
C
)
LP to
BP

1
<
0
<
2
C = tan[0.5(
2
-
1
)], | = cos
0
or
LP to
BS

1
<
0
<
2
C = tan[0.5(
2
-
1
)], | = cos
0
or
( ) 1
1
+

z C
z
( )
1
1

+
z
z C
( ) 1
1 2
2
2

+
z C
z z |
( )
1 2
1
2
2
+

z z
z C
|
( ) | |
( ) | |
1 2
1 2
5 . 0 cos
5 . 0 cos
O O
O + O
= |
( ) | |
( ) | |
1 2
1 2
5 . 0 cos
5 . 0 cos
O O
O + O
= |
Bilinear Transformation for
Peaking & Notch Filters
45
oIf bilinear transformation is used to design a
second-order digital peaking (BP) filter with a 3
dB BW of & a center frequency of
0
, we
start with the LP analog prototype:

(6.20)

whose cutoff frequency is 1 rad/s.
( )
1
1
+
=
s
s H
46
oThe analog-to-digital LP to BP transformation is
applied to obtain:

(6.21)



| = cos
0
(6.22)
C = tan(0.5) (6.23)
=
2
-
1
(6.24)
( )
|
|
|
|
.
|

\
|
+

+
+


+
=
C
C
z
C
z
z
C
C
z H
BP
1
1
1
2
1
1
2
2
|
47
oSimilarly, if bilinear transformation is used to
design a second-order digital notch (BS) filter
with a 3 dB notch BW of & a notch frequency
of
0
, we start with LP analog prototype of
Equation 6.20.
oThe analog-to-digital LP to BS transformation is
applied to obtain:

(6.25)

( )
|
|
|
|
.
|

\
|
+

+
+

+
+
=
C
C
z
C
z
z z
C
z H
BS
1
1
1
2
1 2
1
1
2
2
|
|
48
oThe value of | & C are given by the Equation
6.22 & 6.23 respectively.
oIf either design requires for an A dB BW of ,
the constant C is replaced by KC, where

(A is in dB)

oThe LP prototype gain corresponds to an
attenuation of A dB.
o
0
is used to determine the parameter |.
1 10
1
1 . 0

=
A
K
49
oIf only the band edges
1
&
2
are specified
instead of
0
, | can be found from the alternative
relation in terms of the given band edges.
oHere,
0
can be found by means of geometric
symmetry of the prewarped frequencies:


oTo find the digital band edges of
1
&
2
, we
can start from the expression:
( ) ( ) ( )
2 1 0
5 . 0 tan 5 . 0 tan 5 . 0 tan O O = O
( ) | |
( ) | |
( ) | |
( ) AO
O + O
=
O O
O + O
= O =
5 . 0 cos
5 . 0 cos
5 . 0 cos
5 . 0 cos
cos
1 2
1 2
1 2
0
|
50
From Eq. 6.24, we get
1
=
2
- . Then,



Example 6.5
Design a peaking filter (BP filter) with a 3 dB BW
of 5 kHz & a center frequency of 6 kHz. The
sampling frequency is 25 kHz.
( ) | | ( ) AO O = O + O 5 . 0 cos cos 5 . 0 cos
0 1 2
( ) ( ) | | AO O = O + O

5 . 0 cos cos cos 5 . 0
0
1
1 2
( ) ( ) | | AO O = AO O + O

5 . 0 cos cos cos 5 . 0
0
1
2 2
( ) | | AO O + AO = O

5 . 0 cos cos cos 5 . 0
0
1
2
51
+Solution






C = tan(0.5) = 0.7265
| = cos
0
= 0.0628
Substituting these into Equation 6.21:
( )
t
t t
4 . 0
25
5 2 2
3
= = = AO
S
f
dB
( )
t
t t
48 . 0
25
6 2 2
0
0
= = = O
S
f
52
Magnitude
spectrum of the
bandpass filter
( )
( )
|
|
|
|
.
|

\
|
+

+
+


+
=
7265 . 0 1
7265 . 0 1
7265 . 0 1
0628 . 0 2
1
7265 . 0 1
7265 . 0
2
2
z z
z
z H
BP
( )
( )
1584 . 0 0727 . 0
1 4208 . 0
2
2
+

=
z z
z
z H
BP
53
+The band edge
2
can be computed using
Equation 6.28:

2
= 2.1483

1
can be computed using Equation 6.24:

1
=
2
- = 2.1483 - 0.4t = 0.8917
( ) ( ) ( ) ( ) | | t t t 4 . 0 5 . 0 cos 48 . 0 cos cos 4 . 0 5 . 0
1
2

+ = O
54
As a result, these correspond to:
( )
kHz
S
f 55 . 3
2
10 25 8917 . 0
2
3
1
1
=

=
O
=
t t
( )
kHz
S
f 55 . 8
2
10 25 1483 . 2
2
3
2
2
=

=
O
=
t t

You might also like