Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital...

48
Nov '04 CS3291: Section 6 1 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter design

Transcript of Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital...

Page 1: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 1

UNIVERSITY of MANCHESTER

Department of Computer Science

CS3291: Digital Signal Processing

Section 6

IIR discrete time filter design

Page 2: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 2

6.1. Introduction:

• Many design techniques for IIR discrete time filters have adopted ideas of analogue filters

• Transform Ha(s) for analogue ‘prototype’ filter into H(z) for discrete time filter.

• Begin with a reminder about analogue filters.

6.2. Analogue filters

Page 3: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 3

• Analogue filters have transfer functions: a0 + a1s + a2s2+ ... + aNsN

H a (s) = b0 + b1s + b2s2 + ... + bMsM

• Replace s by j for frequency-response.

• For RE(s) 0, Ha(s ) is Laplace Transform of h a (t).• In terms of poles and zeros:

(s - z 1 ) ( z - z 2 ) ... ( s - z N) Ha(s) = K (s - p 1 ) ( z - p 2 ) ... ( s - p M)

• Many known techniques for deriving Ha(s); e.g. Butterworth low-pass approximation•Analogue filters have infinite impulse-responses.

Page 4: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 4

Analogue Butterworth low-pass filter of order n

nC

G2)/(1

1)(

[n/2]

1k

2

212sin21 1

1

cc

p

c

a

ssnk

ssH

[n/2] is integer part of n/2 & P = 0 /1 if n is even / odd

Page 5: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 5

[n/2]

1k

2

212sin21 1

1

cc

p

c

a

ssnk

ssH

Ca

Cs

sHGn

/1

1)(

)/(1

1)( : 1

2

24 )/(/21

1)(

)/(1

1)( : 2

CC

a

Css

sHGn

1 when )1)(1(

1 )(:3

2

Ca sss

sHn

Page 6: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 6

1 when )...1)(..1(

1 )(

:4

22

Ca sssssH

n

)...1)(..1)(1(

1 )(

:5

22 ssssssH

n

a

Page 7: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 7

radian/s

Butterworth low-pass

0

0.2

0.4

0.6

0.8

1

1.2

0 1 2 3 4 5 6

Ga

in

n=2

n=1

n=4

Page 8: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 8

y(t) + RC dy(t)/dt = x(t)

Take Laplace transforms: Y(s) + RC sY(s) = X(s)

Y(s) 1 Ha(s) = = X(s) 1 + RC s 1 1Ga () = Ha(j ) = = 1 + RC j [ 1 + (/C ) 2 ]

C = 1/(RC) Shown graphically when C = 1

y(t)x(t)

6.3 First order RC filterR

C

Page 9: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 9

Gain-response of RC filter

Gain response of RC filter-14

-12

-10

-8

-6

-4

-2

0

0 1 2 3 4 5

Radians/second

Ga

in (

dB

)

Page 10: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 10

Impulse response:-

0 : t < 0 ha (t) = (1/[RC]) e - t / (R C) : t 0

How to transform this filter to a discrete time filter?

Page 11: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 11

Example:

A filter has system function H(s) = (1+s) / (1 + 2 s + 3 s2) .

What is its differential equation.

Solution:

y(t) + 2dy(t)/dt + 3 d2y(t)/dt2 = x(t) + dx(t)/dt

It’s easy!

Page 12: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 12

• Transform an analogue filter with transfer functn H(s) into a digital filter.

• Many ways exist.

• We consider four.

Page 13: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 13

6.4. Firstly, dispose of a method that will not work.

• Replacing s by z (or z -1 ) in Ha (s) to obtain H(z).

• Taking previous example with RC = 1:

1 1 Ha (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:-

Page 14: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 14

With pole at z=-0.99, what does gain-response look like?

Imag pt z

Re pt z

High-passinstead of low pass.Forget this one.

G()

Page 15: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 15

Substituting : y[n] + RC ( y[n] - y[n-1] ) / T = x[n]

(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 diffnce eqn.

6.5 “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:

T

nyny

T

Ttyty

dt

tdy ]1[][

)()(

)(

Page 16: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 16

Signal flow graph for y[n] = a 0 x[n] - b1 y[n-1]

x[n] y[n]

a0

-b1

Page 17: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 17

•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 , (fS =10 kHz.)

a 0 = 1/(1 + RC/T) = 0.239057b 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) = Ha(s) = (1 - 0.76 z - 1 ) 1 + s/(5002)

0.0576 1H(ej)2 = H(j)2 = 1.58 - 1.52cos() 1 + (/ 3142)2

Page 18: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 18

Compare gain-responses:-

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

0 1000 2000 3000 4000 5000 6000

Hz

Ga

in

ANALOG

DISCRETE TIME

Shapes similar, but not exactly the same.Replaces s by (1 - z - 1 )/T Not commonly used

Page 19: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 19

6.6. “Impulse-response invariant” technique

• Transforms analog prototype to IIR discrete time filter.

• See text-books

• Not on exam

Page 20: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 20

Intro to Bilinear Transformation method

• Most common method for transforming Ha (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. d2y(t)/dt2 at t=nT (y[n] - 2y[n-1]+y[n-2])/T2

d3y(t)/dt3 at t=nT (y[n]-3y[n-1]+3y[n-2]-y[n-3])/T3

“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.

Page 21: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 21

• Bilinear approximation:

0.5( D[n] + D[n-1]) (y[n] - y[n-1]) / T

& similarly for dx(t)/dt at t=nT.

• Similar formulae may be derived for d2y(t)/dt2, and so on.

• If D(z) is z-transform of D[n] :

0.5( D(z) + z-1D(z) ) = ( Y(z) - z-1Y(z) ) / T

)(1

12 )(

1

1

5.0

1 )(

1

1

zYz

z

TzY

z

z

TzD

Page 22: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 22

replacing s by [ (2/T) (z-1)/(z+1)] is bilinear approximation.

If LT of y(t) is Y(s) LT of dy(t)/dt is sY(s).

sy(t) dy(t)/dt

(2/T) (z-1)/(z+1){y[n]} {dy(t)/dt / t=nT}

Page 23: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 23

6.7. Bilinear transformation:

•Most common transform from Ha (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)

1

12

z

z

T

Page 24: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 24

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) = Ha(s) where s = 2 (z + 1)(ii) Order of H(z) = order of Ha(s)

(iii) If Ha(s) is causal & stable, so is H(z).

(iv) H(ej) = Ha(j ) where = 2 tan(/2)

Page 25: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 25

Proof of (iii): Let zp be a pole of H(z).

Then sp 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 + b2

z p = and z p 2 = -a + 2 - jb (2 - a)2 + b2

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.

Page 26: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 26

Proof of (iv):

When z = ej, then

ej - 1 2(e j / 2 - e - j / 2 ) s = 2 = ej + 1 e j / 2 + e -j / 2

2( 2 j sin ( / 2) = 2 cos ( / 2)

= 2 j tan( / 2)

Page 27: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 27

Frequency warping:

By (iv), H(ej) = Ha(j) with = 2 tan(/2). from - to mapped to in the range - to .

-3.14

-2.355

-1.57

-0.785

0

0.785

1.57

2.355

3.14

-12 -10 -8 -6 -4 -2 0 2 4 6 8 10 12

Radians/secondRa

dia

ns/s

am

ple

Page 28: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 28

• Mapping approx linear for in the range -2 to 2.

• As increases above 2 , a given increase in produces smaller and smaller increases in .

Page 29: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 29

Comparing (a) with (b) below, (b) becomes more and more compressed as .

|Ha(j )| |H(exp(j )|

(a): Analogue gain response (b): Effect of bilinear transformation

Frequency warping must be taken into account with this method

Page 30: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 30

6.8. Design of IIR low-pass filter by bilinear transfmGiven 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 Ha(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.

Page 31: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 31

•Example Design 2nd 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

Page 32: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 32

which may be realised by the signal flow graph:-

x[n] y[n] 0.093

2 0.94

-0.33

21

21

33.094.01

21093.0

zz

zzzH

Page 33: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 33

6.9 Higher order IIR digital filters:• Normally cascaded biquad sections.• Example 6.3: Design 4th order Butterwth-type IIR low-pass digital filter with 3 dB c/o at fS / 16. .

Solution: (a) Relative cut-off frequency is /8. Prewarped cut-off : C = 2 tan((/8)/2) 0.4 radians/s.Formula for 1 radian/s cut-off is:

22 85.11

1

77.01

1

sssssH a

Replace s by s/0.4 then replace s by 2 (z-1) / (z+1) to obtain:

48.0365.1

12028.0

74.06.1

12033.0

2

2

2

2

zz

zz

zz

zzzH

Page 34: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 34

H(z) may be realised as:

x[n] 0.033

2 1.6

-0.74

0.028 y[n]

2 1.36

-0.48

Fourth order IIR Butterworth filter with cut-off fs/16

Page 35: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 35

Analogue gain resp.

-0.1

0.1

0.3

0.5

0.7

0.9

1.1

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5

Radians/second

Ga

in

Gain response of 4th order IIR filter

-0.1

0.1

0.3

0.5

0.7

0.9

1.1

0 0.785 1.57 2.355 3.14

Radians/sample

Ga

in

Page 36: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 36

•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   .

Page 37: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 37

6.10. High-pass band-pass and band-stop IIR filters• Apply bilinear transformation to Ha(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 , u = 2 tan((/2)/2)) = 2 tan(/4) = 2Need 4th order H a (s) with pass-band L to  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

Ha(s) = s 4 + 1.65 s 3 + 4.69 s 2 + 2.75 s + 2.76

Page 38: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 38

• We have a problem as the denominatr is not product of 2nd order expressions in s.• We have to re-express it in this form. • This cannot be done without a computer!•One way is to find the roots of the denom using MATLAB:

roots([1 1.64 4.69 2.75 2.76])

-0.54 + 1.7 j -0.54 - 1.7 j -0.28 + 0.88 j -0.28 - 0.88 j

(s - ( -0.54 +1.7j ) ) (s - (-.54-1.7j ) ) = ( s2 + 1.08s + 3.18)(s - (-0.28 + 0.88 j) ) ( s - (-0.28 - 0.88) ) = (s2 + 0.56s + 0.85)

Page 39: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 39

• After factorising (using MATLAB):

1.37 s 2 H a (s) = (s 2 + 1.08 s +3.18)(s 2 +0.56 s + 0.85)

• 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)

Page 40: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 40

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:

-50

-45

-40

-35

-30

-25

-20

-15

-10

-5

0

0 0.785 1.57 2.355 3.14

Radians/sample

Ga

in (

dB

.)

Page 41: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 41

• There are alternative ways of converting Ha(s) into second order sections (SOS) in the MATLAB SP tool-box.

• Can replace s by 2(z - 1)/(z + 1) in the ‘4th order sectn’ expression for Ha(s) then use

[sos G] = tf2sos ([a4 a3 a2 a1 a0], [b4 … b0 ])

• tf2sos does not like functions of s.

• So we have to convert to a digital filter before using it.

• ‘help tf2sos’ to find out abt this function

• I will try to find a more elegant way of doing this one day!

Page 42: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 42

•Option of cascading high pass & low-pass digital filters to give band-pass or band-stop filters must be used with care.

•It is much simpler & avoids the factorisation problem.

• Calculate U & L by prewarping U & L

•Then make sure that analogue prototype is wide-band i.e. U >> 2 L before applying bilinear transformatn.

• If it’s not wide-band, use the factorisation method.

• High-pass filters are easy:

•Apply transformation s C/s to Ha(s) for a 1 radian/s low-pass filter where C is prewarped c/o freq.

• Then apply the bilinear transformation as usual.

Page 43: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 43

Final note:

All these design techniques, and many more, are available in the MATLAB SP toolbox.

End of ‘bilinear transformation’ method

Page 44: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 44

6.11. 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.

Page 45: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 45

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.

Page 46: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 46

Problems:1 Find H(s) for 3rd order Butterwth low-pass filter with C = 1.2. Find H(s) for 3nd order Butterworth low-pass analog filter with cut-off C Give its differential equation. Apply derivative approx technique to derive 3rd order IIR Butterwth-type digital filter with cut-off 500 Hz where fS= 10 kHz.3. A 3rd order low-pass IIR discrete time filter is required with 3 dB cut-off at f S /4. Apply bilinear transfn to Butterwth low- pass transfer function to design it & give its signal flow graph as 2nd & 1st order sections in serial cascade. 4. Give program to implement 3rd order IIR filter above in floating point arithmetic. Then do it in fixed point arithmetic.5. Low-pass IIR digital filter required with cut-off at f s / 4 & stop-band attenuation at least 20 dB for all frequencies above 3f s /8 & below f s /2. Design by bilinear transfn applied to H(s) for Butterwth low-pass, showing that minimum order required is 3.

Page 47: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 47

6 Butterworth-type IIR low-pass digital filter needed with 3 dB c/o at fS / 16. Attenuation must be at least 24 dB above fS / 8. What order is needed? 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

20 log 1 0(1/[1+(.83/.4) 2 n ]) < -24 i.e. [1 + (2.1) 2 n ] >10 1.2

Hence 1 + (2.1) 2 n > 10 2 . 4 = 252 . 2.1 2n > 251 n = 4 is smallest possible

Page 48: Nov '04CS3291: Section 61 UNIVERSITY of MANCHESTER Department of Computer Science CS3291: Digital Signal Processing Section 6 IIR discrete time filter.

Nov '04 CS3291: Section 6 48

7. Design a 4th order band-pass IIR digital filter with lower & upper cut-off frequencies at 300 Hz & 3400 Hz when fS = 8 kHz.

8. Design a 4th order band-pass IIR digital filter with lower & upper cut-off frequencies at 2000 Hz & 3000 Hz when fS = 8 kHz

9. (This is really for Sectn 5) . What limits how good a notch filter we can implement on a fixed point DSP processor? In theory we can make notch sharper & sharper by moving poles closer & closer to zeros. What limits us in practice. I wonder how sharp a notch we could get in 16-bit fixed pt arithmetic?