Presentation is loading. Please wait.

Presentation is loading. Please wait.

Nov '03csDSP61 CS3291: Section 6 IIR discrete time filter design Introduction: Many design techniques for IIR discrete time filters have adopted ideas.

Similar presentations


Presentation on theme: "Nov '03csDSP61 CS3291: Section 6 IIR discrete time filter design Introduction: Many design techniques for IIR discrete time filters have adopted ideas."— Presentation transcript:

1 Nov '03csDSP61 CS3291: Section 6 IIR discrete time filter design Introduction: Many design techniques for IIR discrete time filters have adopted ideas of analogue filters Transform H a (s) for analogue ‘prototype’ filter into H(z) for discrete time filter. Begin with a reminder about analogue filters.

2 Nov '03csDSP62 Analogue filters have transfer functions: a 0 + a 1 s + a 2 s 2 +... + a N s N H a (s) =  b 0 + b 1 s + b 2 s 2 +... + b M s M Replace s by j  for frequency-response. For RE(s)  0, H a (s ) is Laplace Transform of h a (t). In terms of poles and zeros: (s - z 1 ) ( z - z 2 )... ( s - z N ) H a (s) = K  (s - p 1 ) ( z - p 2 )... ( s - p M ) Many known techniques for deriving H a (s); e.g. Butterworth low-pass approximation Analogue filters have infinite impulse-responses.

3 Nov '03csDSP63 Analogue Butterworth low-pass filter of order n [n/2] is integer part of n/2 & P = 0 /1 if n is even / odd

4 Nov '03csDSP64

5 Nov '03csDSP65

6 Nov '03csDSP66

7 Nov '03csDSP67 y(t) + RC dy(t)/dt = x(t) Take Laplace transforms: Y(s) + RC sY(s) = X(s) Y(s) 1 H a (s) =  =  X(s) 1 + RC s 1 1 G a (  ) =  H a (j  )  =  =   1 + RC j   [ 1 + (  /  C ) 2 ] (  C = 1/(RC) Shown graphically when  C = 1 y(t)x(t) ExampleR C

8 Nov '03csDSP68 Gain-response of RC filter

9 Nov '03csDSP69 Impulse response:-  0 : t < 0 h a (t) =   (1/[RC]) e - t / (R C) : t  0 How to transform this filter to a discrete time filter?

10 Nov '03csDSP610 Firstly, dispose of a method that will not work. Replacing s by z (or z -1 ) in H a (s) to obtain H(z). Taking the previous example with RC = 1: 1 1 H a (s) =  H(z) =  1 + s 1 + z H(z) has pole at z = -1. Even if we moved it to z=0.99, still no good:-

11 Nov '03csDSP611 With pole at z=-0.99, what does gain-response look like? High-pass instead of low pass. Forget this one.  G(  ) 

12 Nov '03csDSP612 “Derivative approximation” technique Differential equn of RC filter is: y(t) + RC dy(t)/dt = x(t) Sample x(t), y(t) at T seconds to obtain x[n] & y[n]. Assuming T small: dy(t) y(t) - y(t - T) y[n] - y[n-1]    =  dt T T Substituting into the differential equn: y[n] = x[n] - (RC/T)(y[n] - y[n-1]) (1 + RC/T) y[n] = x[n] + (RC/T)y[n-1] y[n] = a 0 x[n] - b 1 y[n-1] a 0 = 1/(1+RC/T) b 1 = -RC / (T + RC) Recursive difference equation.

13 Nov '03csDSP613 Signal flow graph for y[n] = a 0 x[n] - b 1 y[n-1]

14 Nov '03csDSP614 For analogue filter :  C = 1/(RC) rad/s. To make cut-off 500 Hz: RC = 1 / (2  x 500) = 0.0003183. Let T = 0.0001 s, (f S =10 kHz.) a 0 = 1/(1 + RC/T) = 0.239057 b 1 = - RC/(T + RC) = - 0.760943 Difference equation is: y[n] = 0.24 x[n] + 0.76 y[n-1] 0.24 1 H(z) =  H a (s) =  (1 - 0.76 z - 1 ) 1 + s/(500  2  ) 0.0576 1  H(e j  )  2 =   H(j  )  2 =  1.58 - 1.52cos(  ) 1 + (  / 3142) 2

15 Nov '03csDSP615 Compare gain-responses:- Shapes similar, but not exactly the same. Replaces s by (1 - z - 1 )/T Not commonly used

16 Nov '03csDSP616 “Impulse-response invariant” technique: Transforms analogue prototype to IIR discrete time filter. See text-books Not on exam

17 Nov '03csDSP617 Intro to Bilinear Transformation method Most common method for transforming H a (s) to H(z) for IIR discrete time filter. Consider derivative approximation technique: D[n] = dy(t) /dt at t=nT  ( y[n] - y[n-1]) / T. dx(t) /dt at t=nT  (x[n] - x[n-1]) / T. d 2 y(t)/dt 2 at t=nT  (y[n] - 2y[n-1]+y[n-2])/T 2 d 3 y(t)/dt 3 at t=nT  (y[n]-3y[n-1]+3y[n-2]-y[n-3])/T 3 “Backward difference” approximation introduces delay which becomes greater for higher orders. Try "forward differences" : D[n]  [y[n+1] - y[n]] / T, etc. But this does not make matters any better.

18 Nov '03csDSP618 Bilinear approximation: 0.5( D[n] + D[n-1])  (y[n] - y[n-1]) / T and similarly for dx(t)/dt at t=nT. Similar formulae may be derived for d 2 y(t)/dt 2, and so on. If D(z) is the z-transform of D[n] : 0.5( D(z) + z -1 D(z) ) = ( Y(z) - z -1 Y(z) ) / T  D(z) = [2 (1 - z -1 )/ [T(1+z -1 )] Y(z) = [ (2/T) (z-1)/(z+1)] Y(z). Applying y[n] to [(2/T) (z-1)/(z+1)] gives  dy(t)/dt at t=nT. Applying y(t) to H(s) = s produces dy(t)/dt. ( Since LT of dy(t)/dt is sY(s) )  replacing s by [ (2/T) (z-1)/(z+1)] is bilinear approximation.

19 Nov '03csDSP619 Bilinear transformation: Most common transform from H a (s) to H(z). Replace s by (2 / T) (z-1) / (z+1) to obtain H(z). For convenience take T=1. Example 1 1 H a (s) =  then H(z) =  1 + RC s 1 + RC z + 1 =  (1 + 2RC)z + (1 - 2RC)

20 Nov '03csDSP620 Re-express as: 1 + z - 1 H(z) = K  1 + b 1 z - 1 where K = 1 / (1 + 2RC) & b 1 = (1 - 2RC) / (1 + 2RC) Properties: (z - 1) (i) H(z) = H a (s) where s = 2  (z + 1) (ii) Order of H(z) = order of H a (s) (iii) If H a (s) is causal & stable, so is H(z). (iv) H(e j  ) = H a (j  ) where  = 2 tan(  /2)

21 Nov '03csDSP621 Proof of (iii): Let z p be a pole of H(z). Then s p must be a pole of H a (s) where s p = 2 (z p - 1) / (z p + 1). If s p = a + jb then (z p + 1)(a + jb) = 2 (z p - 1), a + 2 + jb (a + 2) 2 + b 2  z p =  and  z p  2 =  -a + 2 - jb (2 - a) 2 + b 2 Now a < 0 as H a (s) is causal & stable,   z p  must be < 1.  if all poles of H a (s) have real parts < 0, all poles of H(z) must lie inside unit circle.

22 Nov '03csDSP622 Proof of (iv): When z = e j , then e j  - 1 2(e j  / 2 - e - j  / 2 ) s = 2  =  e j  + 1 e j  / 2 + e -j  / 2 2( 2 j sin (  / 2) =  2 cos (  / 2) = 2 j tan(  / 2)

23 Nov '03csDSP623 Frequency warping: By (iv), H(e j  ) = H a (j  ) with  = 2 tan(  /2).  from -  to  mapped to  in the range -  to .

24 Nov '03csDSP624 Mapping approx linear for  in the range -2 to 2. As  increases above 2, a given increase in  produces smaller and smaller increases in .

25 Nov '03csDSP625 Comparing (a) with (b) below, (b) becomes more and more compressed as    . Frequency warping must be taken into account with this method

26 Nov '03csDSP626 Design of IIR low-pass filter by bilinear transfm Given cut-off frequency  C in radians/sample:- (i) Calculate  C = 2 tan(  C /2) radians/sec. (  C is "pre-warped" cut-off frequency) (ii) Find H a (s) for analogue low-pass filter with 1 radian/s cut-off. (iii) Scale cut-off frequency of H a (s) to  C (iv) Replace s by 2(z - 1) / (z+1) to obtain H(z). (v) Rearrange the expression for H(z) (vi) Realise by biquadratic sections.

27 Nov '03csDSP627 Example Design 2 nd order Butterworth-type IIR low-pass filter with  C =  / 4. Solution: Prewarped frequency  C = 2 tan(  / 8) = 0.828 Analogue Butterworth low-pass filter with c/o 1 radian/second: 1 H a (s) =  1 +  2 s + s 2 Scale c/o to 0.828, 1 H a (s) =  1 +  2 s/0.828 + (s/0.828) 2 then replace s by 2 (z+1) / (z-1) to obtain: z 2 + 2z + 1 H(z) =  z 2 - 9.7 z + 3.4

28 Nov '03csDSP628  1 + 2 z -1 + z - 2 H(z) = 0.097     1 - 0.94 z - 1 + 0.33 z - 2  which may be realised by the signal flow graph:-

29 Nov '03csDSP629 Higher order IIR digital filters: Normally cascaded biquad sections. Example: Butterworth-type IIR low-pass digital filter needed with 3 dB c/o at f S / 16. Attenuation at least 24 dB above f S / 8. (a) What order is needed? (b) Design it. Solution: (a) Relative cut-off frequency is  /8. Prewarped cut-off :  C = 2 tan((  /8)/2)  0.40 radians/s. For n t h order Butt low-pass filter with cutoff  C, gain is: 1  H a (j  )  =   [1 + (  /0.4) 2 n ] Gain of IIR filter must be < -24dB at  =  /4.   H a (j  )  must be < -24 dB at  = 2 tan((  /4)/2)  0.83

30 Nov '03csDSP630  20 log 1 0 (1/  [1+(.83/.4) 2 n ]) 10 1.2 Hence 1 + (2.1) 2 n > 10 2. 4 = 252. 2.1 2n > 251 n = 4 is smallest possible (b) For 4th order Butt low-pass with c/o 1 radian/s:  1  1 H a (s) =       1 + 0.77 s + s 2   1 + 1.85 s + s 2  Replace s by s / 0.4. Then replace s by 2(z - 1)/(z +1) to obtain:  1 + 2 z - 1 + z - 2  1 + 2 z -1 + z - 2 H(z) = 0.033    0.028     1 - 1.6 z -1 +.74 z -2   1 -1.37 z -1 + 0.48 z -2 

31 Nov '03csDSP631 H(z) may be realised as:

32 Nov '03csDSP632

33 Nov '03csDSP633 Compare gain-response of 4th order Butt low-pass transfer function used as a prototype, with that of derived digital filter. Both are 1 at zero frequency. Both are 0.707 at the cut-off frequency. Analogue gain approaches 0 as    whereas digital filter gain becomes exactly zero at  = . Shape of Butt gain response is "warped" by bilinear transfn. For digital filter, cut-off rate becomes sharper as    because of the compression as   .

34 Nov '03csDSP634 High-pass band-pass and band-stop IIR filters: Apply bilinear transformation to H a (s) obtained by frequency band transformations. Cut-off frequencies pre-warped to find analog c/o frequencies. Example: 4th order band-pass filter with  L =  /4,  u =  /2. Solution: Pre-warp both cutoff frequencies:  L = 2 tan ((  /4)/2) = 2 tan(  /8) = 0.828, w u = 2 tan((  /2)/2)) = 2 tan(  /4) = 2 Need 4 th order H a (s) with pass-band w L to w u. Start from 2nd order Butt 1 radian/sec: H a (s) = 1 / (s 2 +  2 s + 1). Replace s by (s 2 + 1.66 ) / 1.17 s to obtain: 1.37 s 2 H a (s) =  s 4 + 1.65 s 3 + 4.69 s 2 + 2.75 s + 2.76

35 Nov '03csDSP635 After factorising (using MATLAB): 1.37 s 2 H a (s) =  (s 2 + 1.09 s +3.2)(s 2 +0.57 s + 0.86) Replace s by 2(z - 1)/(z + 1):- 5.48 (z - 1) 2 (z + 1) 2 H(z) =  (9.4 z 2 - 1.57 z + 5 ) ( 6 z 2 - 6.3 z + 3.7)

36 Nov '03csDSP636 Rearrange into 2 biquad sections:  1 - 2 z -1 + z - 2  1 + 2 z - 1 + z - 2 H(z) = 0.1      1 - 0.17 z -1 + 0.54 z -2  1 - 1.05 z -1 + 0.62 z - 2  whose gain response is:

37 Nov '03csDSP637 Comparison of IIR and FIR digital filters: Advantage of IIR type digital filters: Economical in use of delays, multipliers and adders. Disadvantages: (1) Sensitive to coefficient round-off inaccuracies & effects of overflow in fixed point arith. These effects can lead to instability or serious distortion. (2) An IIR filter cannot be exactly linear phase.

38 Nov '03csDSP638 Advantages of FIR filters: (1) may be realised by non-recursive structures which are simpler and more convenient for programming especially on devices specifically designed for DSP. (2) FIR structures are always stable. (3) Because there is no recursion, round-off and overflow errors are easily controlled. (4) An FIR filter can be exactly linear phase. Disadvantage of FIR filters: Large orders can be required to perform fairly simple filtering tasks.


Download ppt "Nov '03csDSP61 CS3291: Section 6 IIR discrete time filter design Introduction: Many design techniques for IIR discrete time filters have adopted ideas."

Similar presentations


Ads by Google