ELEN E4810: Digital Signal Processing Topic 8: Filter Design: IIR
46
0
0
Full text
(2) 1. Filter Design Specifications The filter design process:. performance Analysis constraints • magnitude response • phase response • cost/complexity. Dan Ellis. Design • FIR/IIR • subtype • order. 2013-11-11. G(z) Implement transfer function • platform • structure • .... 2. Solution. Problem. .
(3) Performance Constraints . .. in terms of magnitude response: \G(ejW)\. 0. gain / dB. -10. Passband. -20. -30. -40. 0. 0.1. 0.2. passband edge frequency Dan Ellis. minimum optimal stopband filter attenuation will touch here Stopband. transition band. passband ripple. 0.3. 0.4. 0.5. stopband edge frequency. 2013-11-11. 0.6. 0.7. 0.8 0.9 P frequency W. 3.
(4) Performance Constraints . “Best” filter:. smallest Passband Ripple. narrowest Transition Band. greatest Minimum SB Attenuation . . improving one usually worsens others. But: increasing filter order (i.e. cost) can improve all three measures. Dan Ellis. 2013-11-11. 4.
(5) Passband Ripple. \G(ejW)\. 0. -10. -20. -30. Passband detail. \G(ejW)\. -40. 0. 0.1. 0.2. 0.3. 0.4. 0.5. 0.6. 0.7. 0.8. 0.9. 1 √ E. PB ripple parameter . . Assume peak passband gain = 1 then minimum passband gain = Or, ripple max = 20 log10 1+ . Dan Ellis. 2013-11-11. 2. 1 1+ 2 dB 5. P.
(6) Stopband Ripple. \G(ejW)\. 0. -10. -20. -30. Stopband detail. -40. 0. 0.1. 0.2. 0.3. 0.4. 0.5. 0.6. 0.7. 0.8. 1 A. SB ripple parameter. 0. freq W. Peak passband gain is A× larger than peak stopband gain Hence, minimum stopband attenuation s = 20 log10 A1 = 20 log10 A dB . Dan Ellis. 2013-11-11. 6. 0.9. P.
(7) Filter Type Choice: FIR vs. IIR FIR. IIR. No feedback (just zeros) Always stable Can be linear phase. Feedback (poles & zeros) May be unstable Difficult to control phase. . BUT. . High order (20-2000) Unrelated to continuoustime filtering. Typ. < 1/10th order of FIR (4-20) Derive from analog prototype. . Dan Ellis. . 2013-11-11. 7.
(8) FIR vs. IIR . If you care about computational cost → use low-complexity IIR (computation no object → linear phase FIR). . If you care about phase response → use linear-phase FIR (phase unimportant → go with simple IIR). Dan Ellis. 2013-11-11. 8.
(9) IIR Filter Design . IIR filters are directly related to analog filters (continuous time) . . via a mapping of H(s) (CT) to H(z) (DT) that preserves many properties. Analog filter design is sophisticated. signal processing research since 1940s → Design IIR filters via analog prototype need to learn some CT filter design . Dan Ellis. 2013-11-11. 9.
(10) 2. Analog Filter Design Decades of analysis of transistor-based filters – sophisticated, well understood Basic choices: . ripples vs. flatness in stop and/or passband more ripples → narrower transition band . Dan Ellis. Family. PassBand. StopBand. Butterworth Chebyshev I Chebyshev II Elliptical. flat ripples flat ripples. flat flat ripples ripples. 2013-11-11. 10.
(11) CT Transfer Functions . Analog systems: s-transform (Laplace) . frequency response still from a polynomial. Continuous-time st Transform H a s = ha t e dt. ( ) (). Discrete-time. H d (z ) = hd [n] z. ( ). H a ( j). Frequency response. Hd e. Im{s}. Pole/zero diagram. ej! Re{s}. Dan Ellis. j. Im{z}. j≠ stable poles. n. s-plane s scales freq 2013-11-11. stable poles. 1. Re{z}. z-plane 11.
(12) Butterworth Filters Maximally flat in pass and stop bands Magnitude filter 1 2 order response (LP): H a ( j) = 2N N 1+ c . . ≠ ≪ ≠c, |Ha(j≠)|2 →1. \Ha(j7)\. ( ). 0.8 0.6. N . 0.4. ≠ = ≠c, |Ha(j≠)|2 = 1/2. 0.2 0. 3dB point Dan Ellis. 1. N 0. 1. 2. 3. 7/7c. analog freq 2013-11-11. 12.
(13) Butterworth Filters ≠ ≫ ≠c, |Ha(j≠)|2 →(≠c/≠)2N \Ha(j7)\ / dB. . 6N dB/oct rolloff. Log-log magnitude response. 0. N . -10. slope → -6N dB/oct. -20 -30 -40 -50. N . -60 -70 -1 10. 0. 10. analog freq. n. . 7/7c. 1. 10. d 2 H a ( j) = 0 flat → n d @ ≠ = 0 for n = 1 .. 2N-1. Dan Ellis. 2013-11-11. 13.
(14) Butterworth Filters . How to meet design specifications?. √ E. \Ha(j7)\. 1. 1+. ( ) p c. . 2N. 1. A. . 1+( 7. ). s 2N c. 7p. 7s. k1 = 2 A 1. . k=. =“discrimination”, ≪ 1. Dan Ellis. 1 1+2. 2013-11-11. . 1 A2. Design Equation. N. ( ). 2 A 1 1 log10 2 2 log10 s p. ( ). p s. =“selectivity”, < 1 14.
(15) Butterworth Filters 1. . H a ( j) =. . Traditionally, look it up in a table. 2. 1+ (c )2 N. ... but what is Ha(s)?. calculate N → normalized filter with ΩΩc = 1 scale all coefficients for desired ΩΩ c . 1 In fact, H a ( s ) = i(s pi ) where pi = c e. i1 j N +2 2N. i = 1..N. Im{s}. ×. 2013-11-11. Re{s}. ×. odd-indexed uniform divisions of c-radius circle. Dan Ellis. × ΩΩc. ×. s 2N = 1 c . s-plane 15.
(16) Butterworth Example 0 dB = -1 dB √ E. Design a Butterworth filter with 1 dB cutoff at 1kHz and a minimum attenuation = -40 dB of 40 dB at 5 kHz 7 A 1kHz 5kHz 7p 7s 1 2 1dB = 20 log10 = 0.259 2 1+ 9999 log 1 40dB = 20 log10 A A = 100 N 21 10 0.259 log10 5 s =5 p N = 4 3.28 Dan Ellis. 2013-11-11. 16.
(17) 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º. Or, use Matlab: [B,A] = butter(N,Wc,’s’);. Dan Ellis. 2013-11-11. gain / dB. . 0. -10 -20 -30 -40 -50 -60. 0. 2000. 4000. 6000. freq / Hz. 17. M.
(18) Chebyshev I Filter. Equiripple in passband (flat in stopband) → minimize maximum error. 1 |H(j )| = 1 + 2 TN2 ( 2. gain / dB. . (Чебышёв). ripple depth. 0. N . -10. ) p. -20. N . -30 -40. Chebyshev polynomial of order N Dan Ellis. TN ( ) =. 0. 0.5. 1. cos(N cos 1 ) cosh(N cosh 1 ) 2013-11-11. 1.5. 7. 2. | | 1 | |>1 18.
(19) Chebyshev I Filter TN ( ) =. |H(j )|2 =. cos(N cos 1 ) cosh(N cosh 1 ). 1 1 + 2 TN2 (. | | 1 | |>1. T (7) 5. 2. T5 ( ). 1 0 -1 -2 T25(7) 3. T52 (. ). 2 1 0 -1. 1 1 + 0.1T52 ( ) Dan Ellis. 1/(1+0.1 T25(7)) 1 0.5 0 -2. -1.5. -1. -0.5. 0. 2013-11-11. 0.5. 1. 1.5. 7. 2. 19. p. ).
(20) Chebyshev I Filter . Design procedure: desired passband ripple → " min. stopband atten., ΩΩ , ΩΩ → N : p s . 1 1 1 = = 2 2 2 s A 1+ TN ( p ) 1+ 2 cosh N cosh 1 s p N Dan Ellis. cosh. 1. (. A 2 1 . ( ). 1 s cosh p. [. ). (. )]. 1/k1, discrimination 1/k, selectivity. 2013-11-11. cosh-1 grows slower than log10 20. 2.
(21) Chebyshev I Filter . What is Ha(s)? complicated, get from a table .. or from Matlab cheby1(N,r,Wp,’s’) all-pole; can inspect them: Im{s}. . 1 0.5 0. -0.5 -1 -1. -0.5. 0. 0.5. 1. Re{s}. ..like squashed-in Butterworth (why?) Dan Ellis. 2013-11-11. 21.
(22) Chebyshev II Filter Flat in passband, equiripple in stopband. H a ( j) = 2. constant ~1/TN(1/ΩΩ). 1 2 T ( s ) 2 N p 1+ TN (s ) . gain / dB. . 0. N . -10 -20. N . -30. peak of stopband ripples. -40 -50 -60. 0. 0.5. 1. 1.5. 7. 2. zeros on imaginary axis. Filter has poles and zeros (some ) Complicated pole/zero pattern . Dan Ellis. 2013-11-11. 22.
(23) Elliptical (Cauer) Filters Ripples in both passband and stopband. H a ( j). 2. 1 = 1+ 2 RN2 (p ). function; satisfies RN(ΩΩ-1) = RN(ΩΩ)-1 zeros for ΩΩ<1 → poles for ΩΩ>1 . gain / dB. . PB ripple depth. 0 -10 -20. N . N . -30. peak SB ripples. -40 -50 -60. 0. 0.5. 1. 1.5. very narrow transition band. 7. 2. Complicated; not even closed form for Ν. Dan Ellis. 2013-11-11. 23.
(24) Analog Filter Types Summary Chebyshev I gain / dB. gain / dB. Butterworth 0 -10 -20 -30 -40. -20 -30. -50. c 0. 0.5. 1. 1.5. -60. 2. 0 -10 -20 -30. A. -40. Dan Ellis. 0.5. 1. 0.5. 1. 1.5. 2. r. -10. 1.5. 2. r = 3 dB A = 40 dB. 0. -20 -30. A. -50. s 0. 0. -40. -50. N=6. p. Elliptical gain / dB. gain / dB. Chebyshev II. -60. r. -10. -40. -50 -60. 0. -60. p 0. 2013-11-11. 0.5. 1. 1.5. 2. 24.
(25) Analog Filter Transformations . . lowpass prototype . All filters types shown as lowpass; other types (highpass, bandpass..) derived via transformations 1 s = F ˆ i.e. (s ) H LP (s ) H D (sˆ ). Desired alternate response; still a rational polynomial. General mapping of s-plane ^ BUT keep LHHP & jΩΩ → jΩΩ; poles OK, frequency response ‘shuffled’. Dan Ellis. 2013-11-11. 25.
(26) Lowpass-to-Highpass . Example transformation: H HP (sˆ) = H LP ( s ) s= p ˆ p sˆ. . Dan Ellis. take prototype HLP(s) polynomial ˆp p replace s with sˆ. simplify and rearrange ^ → new polynomial HHP(s). 2013-11-11. 26.
(27) Lowpass-to-Highpass . What happens to frequency response? s = j sˆ = ˆ = . . ˆp p . =j. ˆ = ˆp ˆ < ˆp . > p. ˆ > ˆp . LP stopband. (. ˆp p . ...freq.→freq.. = p < p. LP passband. . ˆp p j. ). imaginary axis stays on self... ^ 7. HPF. LPF. HP passband. 7p ^. 7p. HP stopband. Frequency axes inverted. Dan Ellis. 2013-11-11. 27. 7.
(28) 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 A 1 0.1 1 1 log10 ( ) 10 @ 0.1dB = 10 N p p 10 2 log10 ( ) 1+ ( c ) ➝ N=5, 2N=10 c = p /0.6866 = 1.4564 2. 2. s. p. Dan Ellis. 2013-11-11. 28.
(29) Transformation Example . . 1 j N +2 2N. LPF proto has p = c e N c H LP ( s ) = N =1 ( s p ). ×. Im{s}. × ΩΩc. Re{s}. × ×. Map to HPF: H HP (sˆ) = H LP ( s ) s= p ˆ p. H HP (sˆ) =. . cN. (. ˆp N p sˆ =1. p. ). =. sˆ cN sˆ N. N zeros @ ^s = 0. =1 ( pˆ p p sˆ) N. ^ /p new poles @ s^ = ΩΩpΩΩ p l Dan Ellis. 2013-11-11. 29.
(30) Transformation Example In Matlab: ΩΩp ΩΩs Rp Rs [N,Wc]=buttord(1,4,0.1,40,'s'); [B,A] = butter(N, Wc, 's'); [U,D] = lp2hp(B,A,2*pi*4000); . 4. gain / dB. x 10 1.5. Im{s}. 1. -10. 0.5. -20. 0. -30. -0.5. -40. -1. -50. -1.5 -2. -1. Re{s} Dan Ellis. 0. 0. 1 4 x 10. -60. 0. 2013-11-11. 1000. 2000. 3000. 4000. 5000. 7 / Hz. 30.
(31) 3. Analog Protos → IIR Filters Can we map high-performance CT filters to DT domain? Approach: transformation H (s)→G(z) a i.e. G (z ) = H a (s ) s=F ( z ) where s = F(z) maps s-plane z-plane: . s = F(z) z = F-1(s). Im{s}. Every value of G(z) is a value of Ha(s) somewhere on the s-plane & vice-versa Dan Ellis. Ha(s0). Im{z}. G(z0) Re{z}. Re{s}. s-plane 2013-11-11. 1. z-plane 31.
(32) CT to DT Transformation . Desired properties for s = F(z): . s-plane jΩΩ axis z-plane unit circle → preserves frequency response values. . s-plane LHHP z-plane unit circle interior → preserves stability of poles Im{s}. jΩΩ. Im u.c. Re{s}. s-plane Dan Ellis. Im{z}. 1. ej! Re{z}. LHHP UCI. z-plane. 2013-11-11. 32.
(33) Bilinear Transformation . Solution:. 1 z s= 1+z. 1 1. z 1 Bilinear = z + 1 Transform. 1+ s Hence inverse: z = 1 s . unique, 1:1 mapping. Freq. axis? s = j z =. |z| = 1 i.e. on unit circle. (1+ )+ j z = (1 ) j 2. Poles? s = + j 2 1+ 2 + + 2 z = 2 2 1 2 + + . Dan Ellis. 1+ j 1 j. 2013-11-11. σ<0 |z| < 1 33.
(34) 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. -4 -4 -2 s-plane. . 0. 2. 4. -4 -4. -2. 0. 2 4 z-plane. Highly nonuniform warping! . Dan Ellis. “Moebius Transformations Revealed” http://www.youtube.com/watch?v=G87ehdmHeac 2013-11-11. 34.
(35) Bilinear Transformation . What is CT DT freq. relation ΩΩ ! ? j 2 j sin / 2 j 1e z = e s = 1+e j = 2 cos / 2 = j tan 2. im.axis. u.circle. W (DT). P. . i.e.. = tan (. ). 2 1. = 2 tan . 0.5P. 7. 0. (CT). -0.5P -P -5. 0. 5. infinite range of CT frequency < < maps to finite DT freq. range < < pack it all in! nonlinear; d as ! → º d . Dan Ellis. 2013-11-11. 35.
(36) Frequency Warping Bilinear transform makes j Ge = H a ( j) =2 tan1 for all !, ΩΩ. . ( ). |G(ej )| 0.8. . = 2tan 1( ) 0.6. 0.4. 0.2. 0 -60. -40. -20. 0 0. |Ha(j )| -20. -40. -60. Dan Ellis. 0. 1. 2. 3. 4. 5. Same gain & phase (", A...), in same ‘order’, but with warped frequency axis. 6. 2013-11-11. 36.
(37) Design Procedure . Obtain DT filter specs: . general form (LP, HP...), p , s ,. ‘Warp’ frequencies to CT: p s p = tan 2 s = tan 2 Design analog filter for , , p s. 1 ,1 1+ 2 A. . Oldstyle. . . Convert to DT domain: G (z ) = H a (s ) s=1z1 . . → Ha(s), CT filter polynomial. 1 ,1 1+ 2 A. 1+z 1. → G(z), rational polynomial in z. Implement digital filter!. Dan Ellis. 2013-11-11. 37.
(38) Bilinear Transform Example DT domain requirements: Lowpass, 1 dB ripple in PB, !p = 0.4º, SB attenuation ≥ 40 dB @ !s = 0.5º, attenuation increases with frequency. |G(ejW)| / dB. . 0 -1. PB ripples, SB monotonic → Chebyshev I -40 0.4 0.5. Dan Ellis. 1. WP. 2013-11-11. 38.
(39) Bilinear Transform Example . Warp to CT domain: p p = tan 2 = tan 0.2 = 0.7265 rad/sec s s = tan 2 = tan 0.25 = 1.0 rad/sec. . Magnitude specs: 1 dB PB ripple 1/ 20 1 = 10 = 0.8913 = 0.5087 2 1+. 40 dB SB atten. 40 / 20 1 A = 10 = 0.01 A = 100 Dan Ellis. 2013-11-11. 39.
(40) Bilinear Transform Example Chebyshev I design criteria: 1 A 2 1 cosh N = 7.09 i.e. need N = 8 1 s cosh p Design analog filter, map to DT, check:. ( ). ). \G(ejW)\ / dB. >> >> >> >> >>. (. \Ha(j7)\ / dB. . 0 -10. 0 -10. N=8; wp=0.7265; CT DT freqs(B,A) freqz(b,a) pbripple = 1.0; 7 W/P [B,A] = cheby1(N,pbripple,wp,'s'); [b,a] = bilinear(B,A,.5); M Dan Ellis 2013-11-11 40 -20 -30 -40 -50 -60. -20 -30 -40 -50. 0. 0.5. 1. 1.5. 2. -60. 0. 0.2. 0.4. 0.6. 0.8. 1.
(41) Other Filter Shapes Example was IIR LPF from LP prototype For other shapes (HPF, bandpass,...): . CT trans. Bilinear Analog warp design DT CT HLP(s) specs specs Bilinear transform . HD(s). Bilinear transform GD(z). GLP(z) DT trans. Transform LP→X in CT or DT domain.... Dan Ellis. 2013-11-11. 41.
(42) DT Spectral Transformations . . . Same idea as CT LPF→HPF mapping, but in z-domain: GD (zˆ ) = GL (z ) z=F ( zˆ ) = GL (F (zˆ)) To behave well, z = F (zˆ ) should: . map u.c. → u.c. (preserve G(ej!) values). . map u.c. interior → u.c. interior (stability). F (zˆ) < 1 zˆ < 1 i.e. F (zˆ) = 1 zˆ = 1 in fact, F ( z ˆ ) matches the definition of an 1 allpass filter ... replace delays with F ( zˆ ). Dan Ellis. 2013-11-11. 42.
(43) DT Frequency Warping . zˆ Simplest mapping z = F (zˆ ) = 1 zˆ has effect of warping frequency axis: jˆ e jˆ j zˆ = e z=e = 1 ejˆ Æ>0: W. 0.8. 1+ tan ˆ tan (2 ) = 1 (2 ) . expand HF. P. A = 0.6. 0.6 0.4. 0 0. Dan Ellis. 2013-11-11. Æ<0: expand LF. A = -0.6. 0.2. 0.2. 0.4. 0.6. 0.8. ^ W. P. 43.
(44) Another Design Example . Spec: Bandpass, from 800-1600 Hz (SR = 8kHz) Ripple = 1dB, min. stopband atten. = 60 dB 8th order, best transition band → Use elliptical for best performance . . Full design path: prewarp spec frequencies design analog LPF prototype analog LPF → BPF CT BPF → DT BPF (Bilinear) . Dan Ellis. 2013-11-11. 44.
(45) Another Design Example . Frequency prewarping . 800 Hz @ SR = 8kHz = 800/8000 x 2 rad/sample → L =0.2 , U =1600/8000 x 2 =0.4 . L = tan L/2 = 0.3249, U = 0.7265 Note distinction between: . application’s CT domain (800-1600 Hz) and CT prototype domain (0.3249-0.7265 rad/s) . Dan Ellis. 2013-11-11. 45.
(46) Another Design Example Or, do it all in one step in Matlab: [b,a] = ellip(8,1,60,. . [800 1600]/(8000/2)); . Magnitude (dB). 0 -20. -40. -60. -80. 0. 0.1. 0.2. 0.3 0.4 0.5 0.6 0.7 Normalized Frequency (¾P rad/sample). 0.8. 0.9. 1. 0. 0.1. 0.2. 0.3 0.4 0.5 0.6 0.7 Normalized Frequency (¾P rad/sample). 0.8. 0.9. 1. Phase (degrees). 1000. 500. 0. -500. -1000. Dan Ellis. 2013-11-11. 46.
(47)
Related documents