L08 Iirdesign PDF
L08 Iirdesign PDF
L08 Iirdesign PDF
Topic 8:
Filter Design: IIR
1. Filter Design Specifications
2. Analog Filter Design
3. Digital Filters from Analog Prototypes
Solution
performance G(z)
Analysis constraints Design Implement
transfer
function
• magnitude response • FIR/IIR • platform
• phase response • subtype • structure
• cost/complexity • order • ...
transition band
filter stopband
will touch attenuation
-20 here
gain / dB
Stopband
-30
-40
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 P
passband stopband frequency W
edge edge
frequency frequency
-10
-20
-30
Passband \G(ejW)\
-40
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 P
detail
1
√ E
PB ripple
parameter
Assume peak passband gain = 1 1
then minimum passband gain =
1+ 2
Or, ripple max = 20 log10 1+ 2
dB
Dan Ellis 2013-11-11 5
Stopband Ripple
0
\G(ejW)\
-10
-20
-30
Stopband
-40
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 P
detail
1
A
SB ripple 0
parameter freq W
Peak passband gain is A× larger than
peak stopband gain
Hence, minimum stopband attenuation
( ) ()
Transform H a s = ha t e dt
st
H d (z ) = hd [n] z n
Frequency
response
H a ( j) ( )
Hd e j
Im{s} Im{z}
Pole/zero j≠ ej!
diagram Re{s} Re{z}
stable 1
stable s-plane z-plane
poles poles
s scales freq
Dan Ellis 2013-11-11 11
Butterworth Filters
Maximally flat in pass and stop bands
Magnitude
1 filter
response (LP): H a ( j) =
2
order
( )
2N
1+ c N
≠ ≪ ≠c,
\Ha(j7)\
1
0.8
|Ha(j≠)|2 →1 0.6
0.4
N
≠ = ≠c,
0.2
N
|Ha(j≠)|2 = 1/2 0
0 1 2 3
7/7c
3dB point analog freq
\Ha(j7)\ / dB
0
N
Log-log -10
-20
slope →
magnitude -30
-6N dB/oct
response -40
-50 N
-60
-70
-1 0 1
7/7c
10 10 10
n analog freq
d
H a ( j) = 0
2
flat → n
d
@ ≠ = 0 for n = 1 .. 2N-1
Dan Ellis 2013-11-11 13
Butterworth Filters
How to meet design specifications?
1 1
\Ha(j7)\
( ) 1+2
p 2N
1+
√ E
c Design
Equation
( )
1 1
1
2
A
1 log10 2
1+( )
s 2N A2 N
A
7p 7s
7
c
( )
2 log10 s
p
p
k1 = k=
A 1
2
s
=“discrimination”, ≪ 1 =“selectivity”, < 1
Dan Ellis 2013-11-11 14
Butterworth Filters
1
H a ( j) =
2
... but what is Ha(s)?
1+ (c )2 N
Traditionally, look it up in a table
calculate N → normalized filter with ΩΩc = 1
scale all coefficients for desired ΩΩ
c
1 Im{s}
In fact, H a ( s ) = × ΩΩc
i(s pi ) ×
Re{s}
j N +2 i1 × s 2N
where pi = c e 2N
i = 1..N ×
= 1
c
odd-indexed uniform divisions of c-radius circle
s-plane
Dan Ellis 2013-11-11 15
Butterworth Example
0 dB
Design a Butterworth
= -1 dB
√ E
filter with 1 dB cutoff
at 1kHz and a
minimum attenuation
= -40 dB
of 40 dB at 5 kHz A
1kHz 5kHz
7
1 7p 7s
1dB = 20 log10 = 0.259
2
1+ 2
9999
40dB = 20 log10 A A = 100
1 log
N 21 10 0.259
s log10 5
=5
p N = 4 3.28
Dan Ellis 2013-11-11 16
Butterworth Example
Order N = 4 will satisfy constraints;
What are ΩΩc and filter coefficients?
from a table, ΩΩ-1dB = 0.845 when ΩΩc = 1
ΩΩc = 1000/0.845 = 1.184 kHz
from a table, get normalized coefficients for
N = 4, scale by 1184·2º
gain / dB
0
-10
[B,A] = -40
-50
butter(N,Wc,’s’); -60
0 2000 4000 6000
freq / Hz
Dan Ellis 2013-11-11 17
M
Chebyshev I Filter (Чебышёв)
gain / dB
0
1 depth
|H(j )| = 2 -10
N
1 + 2 TN2 ( p
) -20
-30 N
-40
0 0.5 1 1.5
7 2
cos(N cos 1 ) | | 1
TN ( ) =
cosh(N cosh 1 ) | |>1
T (7)
5
2
T5 ( )
1
0
-1
-2
T25(7)
3
T52 ( )
2
-1
1/(1+0.1 T25(7))
1 1
0.5
1 + 0.1T52 ( ) 0
1 1 1
= =
[
A 1+ TN ( p ) 1+ 2 cosh N cosh 1 s
( )]
2 2 2 s 2
p
N
cosh 1
( A 2 1
) 1/k1, discrimination
( )
cosh-1 grows
1 s 1/k, slower than
cosh p
selectivity log10
0.5
-0.5
-1
-1 -0.5 0 0.5 1
Re{s}
..like squashed-in Butterworth (why?)
Dan Ellis 2013-11-11 21
Chebyshev II Filter
Flat in passband, equiripple in stopband
gain / dB
0
1 N
H a ( j) =
2 -10
-20
N
constant
T ( s )
2 -30
peak of
stopband
2 N p
1+
-40
ripples
TN (s )
-50
-60
~1/TN(1/ΩΩ) 0 0.5 1 1.5
7 2
gain / dB
0
ripple
-10 depth
1
H a ( j)
2
= -20
N N
1+ 2 RN2 (p ) peak
-30
-40 SB
-50 ripples
function; satisfies -60
0 0.5 1 1.5
7 2
gain / dB
0 0
-10 -10 r
-20 -20
-30 -30
-40 -40
-50
c
-50
p
N=6
-60 -60
0 0.5 1 1.5 2 0 0.5 1 1.5 2
r = 3 dB
Chebyshev II Elliptical
A = 40 dB
gain / dB
gain / dB
0 0
-10 -10 r
-20 -20
-30 -30
-40
A -40
A
-50 -50
s p
-60 -60
0 0.5 1 1.5 2 0 0.5 1 1.5 2
> p
ˆ >
ˆp ^
7p
LP stopband HP stopband
Frequency axes inverted
Dan Ellis 2013-11-11 27
Transformation Example
Design a Butterworth highpass filter
^
with PB edge -0.1dB @ 4 kHz (ΩΩp)
^
and SB edge -40 dB @ 1 kHz (ΩΩs)
Lowpass prototype: make ΩΩ = 1
p
p p
ˆ
s = () ˆ = ()4
s
Butterworth -0.1dB @ ΩΩ =1, -40dB @ ΩΩ =4
p s
1 log10 ( ) 1
A 12
0.1
N
2
@ 0.1dB = 10 10
2 log10 ( ) p 10
p
s
p
1+ ( c )
➝ N=5, 2N=10 c = p /0.6866 = 1.4564
Dan Ellis 2013-11-11 28
Transformation Example × ΩΩc
Im{s}
j N +2 1
×
LPF proto has p = c e 2N
Re{s}
×
c N
H LP ( s ) = N ×
=1 ( s p )
Map to HPF: H HP (sˆ) = H LP ( s ) s= p ˆ p
sˆ
N zeros
cN cN sˆ N @ ^s = 0
H HP (sˆ) = =
=1(
N p
sˆ
ˆp
p ) =1 ( pˆ p p sˆ)
N
^ /p
new poles @ s^ = ΩΩpΩΩ p l
gain / dB
1.5 0
1 -10
Im{s}
0.5
-20
0
-30
-0.5
-40
-1
-50
-1.5
-60
-2 -1 0 1 0 1000 2000 3000 4000 5000
7 / Hz
4
Re{s} x 10
|z| = 1 i.e.
Freq. axis? s = j z = 1+ j
1 j on unit circle
(1+ )+ j
Poles? s = + j z = (1 ) j
2 1+ 2 + 2
+ 2
z = σ<0
1 2 + +
2 2
|z| < 1
Dan Ellis 2013-11-11 33
Bilinear Transformation
How can entire half-plane fit inside u.c.?
4 4
3 3
2 2
1 1
0 0
-1 -1
-2 -2
-3 -3
s-plane
-4
-4 -2 0 2 4
-4
-4 -2 0
z-plane
2 4
= tan (
)
0.5P
i.e. 2 0 7
(CT)
= 2 tan 1 -0.5P
-P
-5 0 5
0.6
= 2tan 1( ) Same gain &
0.4 phase (", A...),
0.2
in same ‘order’,
0
-60 -40 -20 0
0
but with
-20
|Ha(j )| warped
-40
frequency axis
-60
0 1 2 3 4 5 6
0
-1
PB ripples,
SB monotonic
→ Chebyshev I
-40
WP
0.4 0.5 1
40 dB SB atten.
40 / 20
A = 10
1 = 0.01 A = 100
Dan Ellis 2013-11-11 39
Bilinear Transform Example
Chebyshev I design criteria:
N
cosh (
1 A 2 1
=
)
7.09 i.e. need N = 8
1 s
cosh p ( )
Design analog filter, map to DT, check:
\Ha(j7)\ / dB
\G(ejW)\ / dB
0 0
-10 -10
-30
-20
-30
>> wp=0.7265; CT DT
-40
-50
-40
-50
freqs(B,A) freqz(b,a)
>> pbripple = 1.0; 7
-60
0
W/P0.5 1 1.5 2
-60
0 0.2 0.4 0.6 0.8 1
CT Bilinear
Bilinear Analog trans HD(s) transform
warp design
DT CT HLP(s)
specs specs GD(z)
Bilinear
transform GLP(z) DT
trans
Transform LP→X in CT or DT domain...
tan (2 ) = 1 (2 )
0.6
1+ tan ˆ
0.4
Æ<0:
A = -0.6 expand LF
0.2
0
0 0.2 0.4 0.6 0.8 P
^
W
Dan Ellis 2013-11-11 43
Another Design Example
Spec:
Bandpass, from 800-1600 Hz (SR = 8kHz)
Ripple = 1dB, min. stopband atten. = 60 dB
-20
Magnitude (dB)
-40
-60
-80
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency (¾P rad/sample)
1000
500
Phase (degrees)
-500
-1000
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency (¾P rad/sample)