IIR Filter Design 9.1 – IIR Filter
Total Page:16
File Type:pdf, Size:1020Kb
www.getmyuni.com Digital Signal Processing IIR Filter Design www.getmyuni.com 9.1 – IIR Filter ¾ Difference Equation N N y(n) = ∑ ai x(n − i) +∑bj y(n − j) i=0 j=1 N ¾Transfer Function −i ∑ ai z i=0 H (z) = N − j 1+ ∑bj z j=1 where; N is the filter’s order. ai,bj are the filter’s coefficients. www.getmyuni.com 9.1 – IIR Filter – contd. • IIR filter have infinite-duration impulse responses, hence they can be matched to analog filters, all of which generally have infinitely long impulse responses. • The basic techniques of IIR filter design transform well-known analog filters into digital filters using complex-valued mappings. • 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. • The basic techniques are called the A/D filter transformation. • However, thAFDtblthe AFD tables are avail ilblable onl y f or lowpass filters. W e al so want design other frequency-selective filters (highpass, bandpass, bandstop, etc.) • To do this, we need to apply frequency-band transformations to lowpass filters. These transformations are also complex-valued mappings, and they are also available in the literature. www.getmyuni.com 9.2 – Design Methods ¾ The following A/D filter transformation methods are used in calculatinggffff the coefficients of IIR filter: 1. Impulse Invariant Method. 2. Bilinear Z-transform Method. Æ to achieve a diggfital filter that has a certain sppfecification e quivalent 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 9.3 – Impulse Invariant Method • Here we require that the impulse response of the discrete system (digital filter) be the discrete version of the impulse response of the analogue system (filter), (Hence t he name: impu lse invariant ). H(s) Ł-1 h(t) t = nT h(nT) Z X T H(z) To remove the sampling effect: ¾ Steps: (1/T) δ(t‐nT) 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ω ω 9 Solution x 0 s + a H (s) = σ [s + (a + jω )][s + (a − jω )] ‐ a s + a 0 0 H (s) = x - ω0 2 2 [(s + a) + ω0 )] −1 −at (1) L {H(s)} = e cos(ω0t) = h(t) −anT (2) h(nT) = e cos(ω0nT) −aT −1 1− e cos(ω0T )z (3) T × Z{h(nT)} = −aT −1 −2aT −2 ×T 1− 2e cos(ω0T )z + e z −aT −1 T − (e T cos(ω0T ))z H (z) = −aT −1 −2aT −2 1− (2e cos(ω0T ))z + e z www.getmyuni.com Example - 1 – cont. −aT −1 T − (e T cos(ω0T ))z H (z) = −aT −1 −2aT −2 1− (2e cos(ω0T ))z + e z a x(n) 0 y(n) X -b1 T a1 X X - b2 T X where, a 0 = T − aT a1 = −e T cos( ω 0T ) − aT b1 = −2e cos( ω 0T ) − 2 aT b2 = e www.getmyuni.com 9.4 – Bilinear Z-Transform (BZT) Method s t z s z s1 Impulse Invariant Method Bilinear Z‐Transform Method • It is the most important method of obtaining IIR filter coefficients. • In the BZT method, the basis operation is to convert an analogue filter H(s) into an equiva lent di g ita l filter H(z) b y usi ng th e bili near approxi mati on. Ha(s) HD(z) sT sT e 2 1 + + ... z = e sT = = 2 1st order bilinear Q − sT approximation 2 1 − sT + ... e 2 1 + sT ∴ z ≅ 2 1 − sT 2 www.getmyuni.com 9.4 – BZT Method – cont. sT 1 + sT sT z ≅ 2 z − z = 1 + 1 − sT 2 2 2 T z - 1 = (z + 1) s 2 2 z −1 ∴s ≅ T z +1 1 H (z) = H (s) 2 z−1 D a s= T z+1 www.getmyuni.com 9.4 – BZT Method – cont. − jΩT 2 z −1 2 e jΩT −1 e 2 s = = × Q jΩT − jΩT T z +1 T e +1 e 2 j ΩT − j ΩT ΩT 2 e 2 − e 2 2 2 j sin ( ) = = 2 j ΩT − j ΩT T 2 2 T 2 cos ΩT e + e ( 2 ) 2 ΩT jω a = j tan ( ) T 2 2 ΩT Pre-Warppgffing effect ω a = tan ( ) T 2 2 −1 ⎛ω T ⎞ Ω = tan ⎜ a Warppgffing effect T ⎝ 2 ⎠ Digital frequency www.getmyuni.com 9.5 – Frequency Warping Effect (BZT) Analogue frequency • The effect of the bilinear Z-transform is called ωa frequency warping: every feature appears in the frequency response o f th e conti nuous-time filt er appears as it is in the frequency response of the discrete-time filter but at different frequency. jω when − ∞ ≤ ω a ≤ ∞ S domain tan(θ) π π Ω − ≤ Ω ≤ σ Digital frequency T T ‐π/2 jΩ θ Ω s Ω s Ωs/2 π/2 − ≤ Ω ≤ S domain 2 2 1 - Ω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 9.6 - IIR Filter Design Procedure Using BZT 1 Given specification in digital domain 2 Convert it into analog filter specification(prewarping) 3 Design analog filter (Butterworth , Chebyshov , elliptic):H(s) 4 Apply bilinear transform to get H(z) out of H(s) ω ω ωs 3 2 ΩT 2 ω a = tan ( ) T 2 ωp | H(jω)| Ω 1 1 1 | H(ejΩ)| 2 1 1+ε A 1 1 + ε 2 4 1 1 H (z) = H (s) 2 1− z −1 A s= ⋅ Ω −1 Ω π T 1+ z p Ωs www.getmyuni.com 9.7 – IIR Filter Design Steps Using BZT 1. Prewarp any critical frequency in the digital filter specifications(ωc,ωp,ωs,…) using; 1 ω = tan Ω T ;T = ( 2 ) Fs 2. Use the diggfital filter sp pfecifications to f ind a suitable normalized p rototyp e analogue LPF, H(s), e.g., for butterworth; 1 • 1st order: H (s) = s +1 1 • 2nd order: H (s) = s2 + 2s +1 For butterworth prototype filter 1 • 3rd order: H (s) = (s +1)(s2 + s +1) Where ⎛ 10 0.1 As − 1 ⎞ log ⎜ ⎟ 10 ⎜ 0.1 A p A the passband ripple in dB ⎝ 10 − 1 ⎠ p N ≥ As the stopband attenuation in dB ⎛ ω ⎞ 2.log ⎜ s ⎟ 10 ⎜ ⎟ ⎝ ω p ⎠ www.getmyuni.com 9.7 – Design Steps – cont. 2. Denormalization according to filter type; (LPF, HPF, BPF, BSF). • LPF s s ω c • HPF s ω c s 2 2 2 • BPF s (s + ω 0 ) sω ;where, ω0 = ω1ω2 ω0 = ω1ω2 2 2 • BSF ω = ω2 −ω1 s sω (s + ω 0 ) 3. MfMap from s-didomain to z-didomain; 1− z −1 s = 1+ z −1 4. Realize the IIR filter . www.getmyuni.com Example – 2 st ¾ Design a 1 order Butterworth HPF with Ωc = 1 rad/sec, Fs = 1Hz. 9 Solution 1 H (s) = s ω s s +1 c 1 s H (s) = = ωc s +1 s +ωc ⎛ Ω cT ⎞ ⎛ 1 ⎞ ω c = tan ⎜ = tan ⎜ ⎝ 2 ⎠ ⎝ 2 ⎠ (1− z −1) (1+ z −1) 1− z −1 H (z) = = (1− z −1) 1− z −1 +ω +ω z −1 +ω c c (1+ z −1) c www.getmyuni.com Example - 2 – cont. 1 1− z −1 H (z) = 1 ω −1 k = 1+ωc c −1 1+ z 1+ωc ωc +1 k a x(n) 0 y(n) X X - b1 T a1 X X where, a 0 = 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 −4 fc = 4 kHz & T = =10 sec Fs 3 −4 ΩcT = 2π × 4×10 ×10 = 2.513 rad Ω T prewarping : ω = tan( c ) = 3.0762 rad c 2 sec 1 H (s) = (s +1)(s2 + s +1) 1 H(z) = 2 2 ⎛ 1 ⎛1− z −1 ⎞ ⎞⎛⎛ 1 ⎞ ⎛1− z−1 ⎞ 1 ⎛1− z−1 ⎞ ⎞ ⎜ ⎜ +1 ⎜⎜ ⎜ + ⎜ +1 ⎜ω ⎜1+ z −1 ⎜⎜ω ⎜1+ z−1 ω ⎜1+ z−1 ⎟ ⎝ c ⎝ ⎠ ⎠⎝⎝ c ⎠ ⎝ ⎠ c ⎝ ⎠ ⎠ www.getmyuni.com Example - 3 – cont. (1+z−1) (1+z−1)2 H(z)= −1 −1 2 −2 −1 2 (1.3249 + 0.6751 z )(0.105 (1−z ) + 0.3249 (1−z )+(1+z ) ) (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 ) 1.4305 ()1 + 1.2506 z −1 + 0.5457 z − 2 (1 + z −1 ) (1 + 2 z −1 + z −2 ) = 0.52763 × × (1 + 0.5095 z −1 ) (1 + 1.2506 z −1 + 0.5457 z − 2 ) www.getmyuni.com Example - 3 – cont.