Digital Signal Processing: IIR Filter Design
Digital Signal Processing: IIR Filter Design
Digital Signal Processing: IIR Filter Design
com
Digital Signal Processing
∑a z
¾Transfer Function −i
i
H ( z) = i =0
N
1+ ∑ bj z −j
j =1
where; N is the filter’s order.
ai,bj are the filter’s
filter s coefficients.
www.getmyuni.com
• The advantage of these techniques lie in the fact that both analog filter
design (AFD) tables and the mappings are available extensively in the
literature.
• However, th
H the AFD tables
t bl are available
il bl only l for
f lowpass
l filt
filters. We
W also
l
want design other frequency-selective filters (highpass, bandpass, bandstop,
etc.)
Æ to achieve a digital
g filter
f that has a certain specification
p f equivalent
q to an
analogue filter
Note
¾ We have no control over the phase characteristics of the IIR
filter. Hence IIR filter designs will be treated as magnitude-only
designs.
www.getmyuni.com
To remove the sampling effect:
(1/T) δ(t‐nT)
¾ Steps:
1. Get H(s), continuous time transfer function of an analogue filter that satisfies the prescribed
magnitude response.
2. Apply the inverse Laplace transform to get the impulse response h(t).
h(n).
3. Obtain a discrete version of h(t) by replacing t by nT Æ h(nT). h(t)
4. Apply the Z-transform to h(nT) to get H(z) and multiply by T.
h(nT)
n
n ∞
www.getmyuni.com
Example - 1
¾ Using the invariant impulse response method, design a digital
filter that has the shown pole-zero distribution. jω
x ω0
9 Solution
s+a
H (s) = σ
[ s + ( a + jω 0 )][ s + ( a − jω 0 )] ‐a
s+a
H (s) = x - ω0
[( s + a ) + ω 0 )]
2 2
−1
(1) L {H ( s)} = e − at
cos(ω0t ) = h(t )
(2) h(nT) = e − anT
cos(ω0 nT )
1 − e − aT cos(( ω 0T ) z −1
(3) T × Z{ h(nT)} = ×T
1 − 2e cos( ω 0T ) z + e
− aT −1 − 2 aT − 2
z
T − (e − aT T cos( ω 0T )) z −1
H ( z) =
1 − ( 2e − aT cos( ω 0T )) z −1 + e − 2 aT z − 2
www.getmyuni.com
Example - 1 – cont.
T − (e − aT T cos( ω 0T )) z −1
H ( z) =
1 − ( 2e − aT cos( ω 0T )) z −1 + e − 2 aT z − 2
a0
x(n) y(n)
X
- b1 T a1
X X
- b2 T
X
where, a0 = T
a 1 = − e − aT T cos( ω 0 T )
b1 = − 2 e − aT cos( ω 0 T )
b 2 = e − 2 aT
www.getmyuni.com
1 + sT
sT
e 2 + ...
Qz =e sT
= = 2 1st order bilinear
− sT
1 − sT + ...
approximation
e 2
2
1 + sT
∴ z ≅ 2
1 − sT
2
www.getmyuni.com
2 z −1
∴s ≅
T z +1 1
H D ( z ) = H a ( s ) s = 2 z −1
T z +1
www.getmyuni.com
2 −1 ⎛ ω a T ⎞
Ω = tan ⎜ Warping
p g effect
ff
T ⎝ 2 ⎠
Digital frequency
www.getmyuni.com
2 2
- Ωs/2
• To compensate for this, every frequency specification the designer has a control
over (ωc,ωs,…) has to be ‘prewarped’ by setting it with;
2
ω = tan Ω T 2
T
( ) 2
www.getmyuni.com
ωs
3
2
2
(
ω a = tan Ω T 2
T
)
ωp
| H( jω) | Ω
1 jΩ
1 1
1
| H(e )|
1+ ε 2 A 1
1+ε2
4 1
1
H ( z ) = H (s) 2 1− z −1 A
s= ⋅ π Ω
T 1 + z −1 Ω p Ωs
www.getmyuni.com
( )
using; 1
ω = tan
t ΩT ;T =
2 Fs
2. Use the digital
g filter
f specifications
p f to find
f a suitable normalized prototype
p yp
analogue LPF, H(s), e.g., for butterworth;
1
• st
1 order: H ( s ) =
s +1
1
• 2nd order: H (s) = 2 For butterworth prototype filter
s + 2s + 1
1
• 3rd order: H ( s ) =
( s + 1)( s 2 + s + 1)
Where ⎛ 10 0 .1 As − 1 ⎞
log 10 ⎜⎜ 0 .1 A p ⎟ Ap
p the passband ripple in dB
p pp
⎝ 10 −1⎠
N ≥ As the stopband attenuation in dB
⎛ ωs ⎞
2 . log 10 ⎜ ⎟
⎜ω ⎟
⎝ p⎠
www.getmyuni.com
• BSF s sω ( s 2 + ω )
2 ω = ω2 − ω1
0
3
3. M from
Map f s-domain
d i to z-domain;
d i
−1
1− z
s= −1
1+ z
4
4. Realize the IIR filter.
filter
www.getmyuni.com
Example – 2
¾ Design a 1st order Butterworth HPF with Ωc = 1 rad/sec, Fs = 1Hz.
9 Solution 1
H ( s) = s ωc s
s +1
1 s
H ( s) = =
ωc s +1 s + ωc
⎛ Ω cT ⎞ ⎛1⎞
ω c = tan ⎜ 2 ⎠
= tan ⎜
⎝ ⎝2⎠
−1
(1 − z )
−1
−1
(1 + z ) 1− z
H ( z) = =
−1
(1 − z ) 1 − z + ωc + ωc z
−1 −1
−1
+ ωc
(1 + z )
www.getmyuni.com
Example - 2 – cont.
1 1 − z −1
H ( z) = 1
1 + ωc 1 + ωc − 1 z −1 k=
1 + ωc
ωc + 1
k a0
x(n) y(n)
X X
- b1 T a1
X X
where, a0 = 1
a1 = − 1
ωc −1
b1 =
ωc + 1
www.getmyuni.com
Example - 3
¾ Design a 3rd order Butterworth LPF to have a cutoff frequency at 4 kHz
using the BZT method & assuming a sampling frequency of 10 kHz.
9 Solution 1
f c = 4 kHz & T= = 10 − 4 sec
Fs
Ω cT = 2π × 4 × 103 × 10 −4 = 2.513 rad
Ω cT
prewarping : ωc = tan( ) = 3.0762 rad
2 sec
1
H (s) =
( s + 1)( s 2 + s + 1)
1
H ( z) =
⎛ 2
⎛ 1 ⎛ 1 − z ⎞ ⎞⎜ ⎛ 1 ⎞ ⎛ 1 − z ⎞
−1 −1 2
1 ⎛ 1 − z −1 ⎞ ⎞
⎜ ⎜⎜ + 1 ⎜⎜ ⎜
⎜ + ⎜
⎜ + 1
⎜ ω 1+ z
⎠ ⎠⎝⎜ ⎝ ωc ⎠ ⎝ 1 + z ⎠ ωc ⎝ 1 + z ⎠ ⎟⎠
−1 −1 −1
⎝ c⎝
www.getmyuni.com
Example - 3 – cont.
−1 −1 2
(1+ z ) (1+ z )
H(z) =
(
(1.3249+ 0.6751z−1) 0.105 (1− z−1)2 + 0.3249(1− z−2 ) + (1+ z−1)2 )
(1 + z − 1 ) (1 + 2 z − 1 + z − 2 )
=
1 . 3249 (
(1 + 0 .5095 z −1 ) 1.4305 + 1.789 z −1 + 0 .7806 z − 2 )
(1 + z − 1 ) (1 + 2 z − 1 + z − 2 )
= ×
(
1 . 3249 (1 + 0 .5095 z ) 1 . 4305 1 + 1 . 2506 z −1 + 0 . 5457 z − 2
−1
)
(1 + z − 1 ) (1 + 2 z − 1 + z − 2 )
= 0 . 52763 × ×
(
(1 + 0 .5095 z ) 1 + 1 . 2506 z −1 + 0 . 5457 z − 2
−1
)
www.getmyuni.com
Example - 3 – cont.
Filter Realization (Cascaded Realization)
0 52763
0.52763
x(n) X y(n)
- 0.5095 - 1.2506 2
T T
X X X
- 0.5457
T
X
www.getmyuni.com
Example - 4
¾ Using BZT method, design a digital filter meeting the specifications
given by the following tolerance structure, |H(f)|
¾ assume a Butterworth characteristic for this 1
filter. 0.707
9 Solution
0.1
f
(1) From the specifications, the prewarped frequencies are: 0.5 2 4 kHz
⎛ 2π × 500 ⎞
ω p = tan⎜ = 0.198912
⎝ 2 × 8000 ⎠
⎛ 2π × 2000 ⎞
ωs = tan⎜ =1
⎝ 2 × 8000 ⎠
Example - 4 – contd.
www.getmyuni.com
(2) D
Determine
t i th
the order
d off th
the prototype
t t analogue
l B
Butterworth
tt th LPF using
i ththe ffollowing
ll i
relation,
⎛ 1 ⎞
⎜ − 1 ⎟
⎜ δs 2
⎛ As
⎞
log 10 − 1
⎟ log ⎜ ⎟
10
⎜ 1
⎜ −1⎟ ⎜⎜ A p ⎟⎟
⎝ (1 − δ p ) 2
⎠= ⎝ 10 10
−1⎠
N≥
⎛ ωs ⎞ ⎛ ωs ⎞
2 × log ⎜ ⎟ 2 × log ⎜ ⎟
⎜ω ⎟ ⎜ω ⎟
⎝ p ⎠ ⎝ p⎠
1 1 1 ⎛ 99 ⎞
−1 = − 1 = 99 , − 1 = 2 − 1 = 1 ⇒ log ⎜ ⎟ = 1.995635
δs2 0.01 (1 − δ p ) 2
⎝ 1 ⎠
⎛ ωs ⎞
2 × log⎜ ⎟ = 2 × log⎛⎜ 1 ⎞
⎟ = 1.402678
⎜ω ⎟ ⎝ 0.198912 ⎠
⎝ p⎠
1.995635
N≥ = 1.423. Let N = 2
1.402678
Example - 4 – contd.
www.getmyuni.com
H (s) = =
s 2 + 2 sω p + ω p
2 2
⎛ s ⎞
⎜ ⎟ + 2 s +1
⎜ω ⎟ ωp
⎝ p ⎠
(5) Applying the BZT,
ωp2
H ( z ) = H ( s ) s =⎜⎛ 1− z −1 ⎟⎞ = 2
⎜ 1+ z −1 ⎟
⎝ ⎠ ⎛ 1− z ⎞−1
⎛ 1 − z −1 ⎞
+ 2 ωp⎜ +ωp
2
⎜⎜ −1 ⎟
⎜ −1 ⎟
⎝1+ z ⎠ ⎝ 1+ z ⎠
ω p (1 + z −1 )
2 2
=
(1− z ) +−1 2
(
2 ωp 1− z −1
)(1+ z )+ ω (1+ z )
−1
p
2 −1 2
Example - 4 – contd.
www.getmyuni.com
ω p (1 + 2z −1 + z −2 )
2
H ( z) =
(1− 2z −1
+z −2
)+ 2 ω (1 − z ) + ω (1 + 2z
p
−2
p
2 −1
+z −2
)
ω p 2 (1 + 2 z −1 + z −2 )
H ( z) =
(1 + 2 ω p + ω p ) + 2 (ω p − 1) z + (1 − 2 ω p + ω p ) z −2
2 2 −1 2
Substituting
g the values off the pparameters,
1 + 2 ω p + ω p = 1.32087 , ω p − 1 = −0.96043
2 2
1 − 2 ω p + ω p = 0.7582858 , ω p = 0.0395659
2 2
H (z) =
0 .0395659 1 + 2 z + z ( −1 −2
)
1 .32087 − 1 .92086 z −1 + 0 .7582858 z − 2
Example - 4 – contd.
www.getmyuni.com
H (z) =
(
0 .02995 1 + 2 z − 1 + z − 2 )
−1 −2
1 − 1 .4542 z + 0 .57408 z
k a0
(6) Realization
Realization, x(n) y(n)
X X
- b1 T a1
X X
- b2 T a2
X X
where, k = 0 . 02995
a 0 = 1 , a1 = 2 , a 2 = 1
b1 = − 1 . 4542 , b 2 = 0 . 57408