Presentation is loading. Please wait.

Presentation is loading. Please wait.

ME2300 DIGITAL SIGNAL PROCESSING [Slide 6] IIR Filter Design BY DREAMCATCHER COURSEWARE @ https://www.dreamcatcher.asia/cw

Similar presentations


Presentation on theme: "ME2300 DIGITAL SIGNAL PROCESSING [Slide 6] IIR Filter Design BY DREAMCATCHER COURSEWARE @ https://www.dreamcatcher.asia/cw"— Presentation transcript:

1 1 ME2300 DIGITAL SIGNAL PROCESSING This courseware product contains scholarly and technical information and is protected by copyright laws and international treaties. No part of this publication may be reproduced by any means, be it transmitted, transcribed, photocopied, stored in a retrieval system, or translated into any language in any form, without the prior written permission of Acehub Vista Sdn. Bhd. or their respective copyright owners. The use of the courseware product and all other products developed and/or distributed by Acehub Vista Sdn. Bhd. are subject to the applicable License Agreement. For further information, see the Courseware Product License Agreement. http://dreamcatcher.asia/cw

2 2 6. IIR Filter Design

3 3 IIR filter structure Analog filter design Butterworth filter design Chebyshev filter design IIR filter design based on analog filter design IIR filter design examples Contents

4 4 An Nth-order IIR filter transfer function is characterized by 2N+1 unique coefficients and thus requires 2N+1 multipliers and 2N two-input adders for direct form implementation. Consider a third order IIR filter with transfer function which we can implement as a cascade of two filter sections where IIR Filter: Structure (Direct Form) (Extracted from Chapter 4)

5 5 X(z)X(z) H1(z)H1(z)H2(z)H2(z) W(z)W(z) Y(z)Y(z) w[n]w[n] z -1 + + + y[n]y[n] –d1–d1 –d2–d2 –d3–d3 y[n–1] y[n–2] y[n–3] w[n]w[n] z -1 + + + x[n]x[n] p1p1 p2p2 p3p3 p0p0 IIR Filter: Structure (Direct Form)

6 6 z -1 + + + y[n]y[n] –d1–d1 –d2–d2 –d3–d3 y[n–1] y[n–2] y[n–3] z -1 + + + x[n]x[n] p1p1 p2p2 p3p3 p0p0 x[n]x[n] + + + + + + y[n]y[n] p1p1 p2p2 p3p3 p0p0 –d1–d1 –d2–d2 –d3–d3 Direct form I Direct form I t IIR Filter: Structure (Direct Form)

7 7 y[n]y[n] z–1z–1 + z – 1 + + p1p1 p2p2 p3p3 p0p0 + + + –d1–d1 –d2–d2 –d3–d3 x[n]x[n] y[n]y[n] + + + –d1–d1 –d2–d2 –d3–d3 x[n]x[n] + + + p1p1 p2p2 p3p3 p0p0 3’ 2’ 1’ 3 2 1 Other non-canonic forms IIR Filter: Structure (Direct Form)

8 8 y[n]y[n] z – 1 + + + –d1–d1 –d2–d2 –d3–d3 x[n]x[n] + + + p1p1 p2p2 p3p3 p0p0 y[n]y[n] p1p1 x[n]x[n] –d1–d1 + p2p2 –d2–d2 + + p3p3 –d3–d3 p0p0 + Direct form II (canonic) Direct form II t (canonic) IIR Filter: Structure (Direct Form)

9 9 We can express the numerator and denominator polynomials of the transfer function H(z) as a product of polynomials of lower degree to realize a filter in terms of cascade of low order filter sections. Take H(z) = P(z)/D(z) for example : P1(z)D1(z)P1(z)D1(z) P2(z)D2(z)P2(z)D2(z) P3(z)D3(z)P3(z)D3(z) P1(z)D3(z)P1(z)D3(z) P2(z)D1(z)P2(z)D1(z) P3(z)D2(z)P3(z)D2(z) P1(z)D1(z)P1(z)D1(z) P2(z)D3(z)P2(z)D3(z) P3(z)D2(z)P3(z)D2(z) P1(z)D2(z)P1(z)D2(z) P2(z)D3(z)P2(z)D3(z) P3(z)D1(z)P3(z)D1(z) P1(z)D2(z)P1(z)D2(z) P2(z)D1(z)P2(z)D1(z) P3(z)D3(z)P3(z)D3(z) P1(z)D3(z)P1(z)D3(z) P2(z)D2(z)P2(z)D2(z) P3(z)D1(z)P3(z)D1(z) IIR Filter: Structure (Cascade Realization)

10 10 P1(z)D1(z)P1(z)D1(z) P2(z)D2(z)P2(z)D2(z) P3(z)D3(z)P3(z)D3(z) P2(z)D2(z)P2(z)D2(z) P1(z)D1(z)P1(z)D1(z) P3(z)D3(z)P3(z)D3(z) P3(z)D3(z)P3(z)D3(z) P1(z)D1(z)P1(z)D1(z) P2(z)D2(z)P2(z)D2(z) P1(z)D1(z)P1(z)D1(z) P3(z)D3(z)P3(z)D3(z) P2(z)D2(z)P2(z)D2(z) P2(z)D2(z)P2(z)D2(z) P3(z)D3(z)P3(z)D3(z) P1(z)D1(z)P1(z)D1(z) P3(z)D3(z)P3(z)D3(z) P2(z)D2(z)P2(z)D2(z) P1(z)D1(z)P1(z)D1(z) There are 36 cascade realizations for factored form indicated by the above equation based on pole-zero pairing and ordering. In practice, due to finite word length effects, each realization behaves differently from the others. IIR Filter: Structure (Cascade Realization)

11 11 An IIR filter can be realized in parallel form by making use of partial-fraction expansion of the transfer function. The parallel form I implementation can be achieved by expressing the transfer function in the form For a real pole,  2k and  1k are equal to 0. The parallel form II implementation can be achieved by expressing the transfer function in the form For a real pole,  2k and  2k are equal to 0. IIR Filter: Structure (Cascade Realization)

12 12 z -1 + x[n]x[n] -  11 00  01 +  02 z -1  12 z -1 -  12 -  22 ++ + y[n]y[n] z -1 + x[n]x[n] -  11 00  11 +  22 z -1  12 z -1 -  12 -  22 + + + y[n]y[n] Parallel form I implementationParallel form II implementation Third order IIR filter IIR Filter: Structure (Cascade Realization)

13 13 There are a number of established approximation techniques for the design of analog low pass filters. We will look at two techniques. In practice, the magnitude response characteristics in the passband and stopband cannot be constant and are specified with some acceptable tolerances. 1 1 +  p 1 -  p 0 0 pp ss passbandstopband Transition band  |H a (j  )| Passband edge freq.Stopband edge freq. ss Analog Filter Design: Requirements

14 14 The limits of tolerance,  p, and  p are called ripples can be specified in dB: Peak passband ripple Minimum stopband attenuation The magnitude response can also be given in a normalized form 1 1/  (1 -  2 ) 0 0 pp ss passbandstopband Transition band  |H a (j  )| 1/A Analog Filter Design: Requirements

15 15 Other parameters in low pass analog filter design: Transition ratio or selectivity parameter Discrimination parameter, usually k 1 << 1 Analog Filter Design: Requirements

16 16 The magnitude-squared response of an analog low pass Butterworth filter H a (s) of Nth-order is The gain of the filter in dB is given by At  = 0, the gain in dB is equal to zero and at  =  c, the gain is 3 dB cutoff frequency For  >>  c, the squared-magnitude function is approximated by Analog Filter Design: Butterworth Approximation

17 17 At  2 = 2  1 with  1 >>  c the gain is The gain roll-off per octave in the stopband decreases by 6 dB. The gain roll-off per decade in the stopband decreases by 20 dB. The passband and stopband behaviors of the magnitude response improve with a corresponding decrease in the transition band as the filter order N increases. Analog Filter Design: Butterworth Approximation

18 18 Two parameters: N and  c, completely characterize a Butterworth filter. These are determined from  p, 1/  (1+  2 ),  s, and 1/A. Solving the above (1) (2) (2a) The value computed above is rounded up to the next higher integer. The value obtained can then be used to solve either (1) or (2) to determine  c. Analog Filter Design: Butterworth Approximation

19 19 It is usual to solve (2) to determine  c which satisfies the stopband specification at  s exactly while the passband specification is exceeded providing a safety margin at  p. If (1) is used,  c satisfies the passband at  p exactly while the stopband specification at  s is exceeded. The expression for the transfer function of the Butterworth filter is where (3) Analog Filter Design: Butterworth Approximation

20 20 We can use MATLAB to design an analog Butterworth filter: [z,p,k] = buttap(N) [num,den] = butter(N,Wn,‘s’) [num,den] = butter(N,Wn,‘type’,’s’) [N,Wn] = buttord(Wp,Ws,Rp,Rs,’s’) Analog Filter Design: Butterworth (MATLAB)

21 21 Example 1 Design a second, fourth, and eighth order Butterworth low pass filter using buttap. u13f1a N=2 N=4 N=8 Analog Filter Design: Butterworth (MATLAB)

22 22 Filter design using butter U13f2.m Analog Filter Design: Butterworth (MATLAB) Example 2

23 23 N=17, Wp=1, Ws=1.2,  p =0.1,  s =0.1 N=7, Wp=1, Ws=1.2,  p =0.3,  s =0.3 N=8, Wp=1, Ws=1.5,  p =0.1,  s =0.1 N=3, Wp=1, Ws=1.5,  p =0.3,  s =0.3 u13f3 Analog Filter Design: Butterworth (MATLAB)

24 24 There are two types of approximation. Type 1 The magnitude-squared response of the analog lowpass Type 1 Chebyshev filter is where the Chebyshev polynomial is The order N is determined from the attenuation specification, 1/A, in the stopband at a particular frequency,  =  s. Analog Filter Design: Chebyshev Approximation

25 25 Solving the above we get The transfer function H a (s) is the same as in (3) with p l =  l + j  l, l = 1, 2, …, N where Analog Filter Design: Chebyshev Approximation

26 26 Type 2 The magnitude-squared response of the analog low pass Type 2 Chebyshev filter is The transfer function is given by where p l =  l + j  l, l = 1, 2, …, N Analog Filter Design: Chebyshev Approximation

27 27 where Analog Filter Design: Chebyshev Approximation

28 28 We can use the following M-files to design analog Type 1 Chebyshev filters: [z,p,k] = cheb1ap(N,Rp) [num,den] = cheby1(N,Rp,Wn,‘s’) [num,den] = cheby1(N,Rp,Wn,‘type’,’s’) [N,Wn] = cheb1ord(Wp,Ws,Rp,Rs,’s’) We can use the following M-files to design analog Type 2 Chebyshev filters: [z,p,k] = cheb2ap(N,Rp) [num,den] = cheby2(N,Rp,Wn,‘s’) [num,den] = cheby2(N,Rp,Wn,‘type’,’s’) [N,Wn] = cheb2ord(Wp,Ws,Rp,Rs,’s’) Analog Filter Design: Chebyshev Approximation

29 29 Example 4 Design second, fourth, and eighth order Chebyshev Type 1 low pass filter using cheb1ap. u13f4a N=2 N=4 N=8 Analog Filter Design: Chebyshev Approximation

30 30 Example 5: Filter design using cheby1 and cheby2 cheby1cheby2 cheby1cheby2 u13f5 Analog Filter Design: Chebyshev Approximation

31 31 N=6, Wp=1, Ws=1.2,  p =0.1,  s =0.1 N=3, Wp=1, Ws=1.2,  p =0.3,  s =0.3 N=4, Wp=1, Ws=1.5,  p =0.1,  s =0.1 N=2, Wp=1, Ws=1.5,  p =0.3,  s =0.3 u13f6 Analog Filter Design: Chebyshev Approximation

32 32 Two major issues need to be decided for the design of transfer function : (1) The development of a reasonable filter frequency response specification from the requirements of the overall system in which the digital filter is to be employed. (2) FIR or IIR implementation. 1 1 +  p 1 -  p 0 0 pp  s s passbandstopband Transition band  |G(e j  )| Passband edge freq.Stopband edge freq. ss  Digital Filter Design – Requirements

33 33 1 1/  (1 -  2 ) 0 0 passbandstopband Transition band 1/A pp  s s   |G(e j  )| Similar to the case of analog filter, the limits of tolerance,  p, and  s are called ripples and can be specified in dB: The magnitude response can also be given in normalized form Peak passband ripple Minimum stopband attenuation Digital Filter Design – Requirements

34 34 The maximum value of gain function is 0 dB. The maximum passband attenuation is For  p << 1 Digital Filter Design – Requirements

35 35 IIR filter transfer function: H(z) must be a stable transfer function and of lowest order of N to reduce computational complexity. FIR filter transfer function: H(z) must have the lowest order of N to reduce computational complexity. Digital Filter Design – Filter Type Selection

36 36 For a linear phase, FIR filter coefficients must satisfy h[n] =  h[N – n]. The order N FIR of an FIR filter is considerably higher than the order N IIR of an equivalent IIR filter meeting the same magnitude specifications. Thus an IIR filter is usually computationally more efficient. However, if a group delay of an IIR filter is to be equalized by cascading it with an allpass equalizer, the savings in computation may no longer be significant. For applications where linearity of digital filter phase response is not an issue, an IIR is preferable. Digital Filter Design – Filter Type Selection

37 37 For IIR filters, the most common practice is  Convert digital filter specifications into analog low pass prototype filter specifications.  Determine the analog low pass filter transfer function, H a (s).  Transform H a (s) into the desired digital filter transfer function G(z). Reasons for choosing the approach: analog approximation techniques are highly advanced, they usually yield closed-form solutions; extensive tables are available for analog filter design. IIR Filter Design – Basic Approach

38 38  The imaginary (j  ) axis in the s-plane be mapped onto the unit circle of the z-plane.  The stable transfer function be transformed into a stable digital transfer function. The basic idea behind the conversion of an analog prototype transfer function, H a (s) into a digital IIR transfer function G(z) is to apply a mapping from the s-domain to the z-domain. The mapping function should be such that IIR Filter Design – Basic Approach

39 39 Unlike IIR digital filter design, the FIR filter design does not have any connection with the design of analog filters. The design of FIR filters are thus based on direct approximation of the specified magnitude response. The design of an FIR filter of length N+1 may be accomplished by finding either the impulse response sequence {h[n]} or N+1 samples of its frequency response H(e j  ). FIR vs. IIR Filter Design

40 40 A number of transformations has been proposed to convert analog transfer function H a (s) into a digital transfer function G(z) so that the essential properties of the analog transfer function in the s-domain are preserved in the z-domain. The most commonly used is the bilinear transformation where T is the step size in numerical integration. Digital filter design involves two steps : (1) Inverse bilinear transformation applied to the digital filter specifications to arrive at specifications for analog filters, (2) Bilinear transformation to obtain G(z) from H a (s). IIR Filter Design – Bilinear Transformation Method

41 41 Thus T has no effect on the expression for G(z) and we can use 2 for convenience. where s =  0 + j  0. 0  j0j0 0 Re z Im z 1 s-planez-plane 0  --  Frequency warping  IIR Filter Design – Bilinear Transformation Method

42 42 The transfer function for analog second order notch filters: where magnitude response is and approaches unity or 0 dB at  =0 and  = , zero at  =  0, B=  2 –  1 where  2 and  1 are – 3dB points. IIR Filter Design – Notch Filter

43 43 G(z) can be rewritten as follows where It can be shown that notch frequency,  0 and the 3 dB notch bandwidth B w of the digital notch filter are related to  and  as follows (4) IIR Filter Design – Notch Filter

44 44 Design a second order digital notch filter with a notch frequency at 60 Hz and a 3 dB notch bandwidth of 6 Hz. The sampling frequency employed is 400 Hz. Thus, The transfer function is thus IIR Filter Design – Notch Filter

45 45 u13f7 IIR Filter Design – Notch Filter (Example)

46 46 Consider the design of a low pass IIR digital filter G(z) with a maximally flat magnitude characteristic. The passband edge frequency  p = 0.25  with passband ripple not exceeding 0.5 dB. The minimum stopband attenuation at the stopband edge frequency  s = 0.55  is 15 dB. The analog band edge frequencies are The inverse transition ratio is IIR Filter Design – Low Pass Filter (Example)

47 47 From a passband ripple of 0.5 dB we obtain  2 = 0.1220185 and from a minimum stopband attenuation of 15 dB we obtain A 2 = 31.62277. The inverse discrimination ratio is thus Substituting in the equation (2a) seen earlier we get the order Thus, we use order of 3. The order is then used to determine the 3 dB cut-off frequency  c. We can use equations (1) or (2) as seen earlier. It is preferable to solve (1) as it will ensure smallest ripple in the passband. IIR Filter Design – Low Pass Filter (Example)

48 48 Using buttap of MATLAB, we obtain the third order normalized low pass Butterworth transfer function as with 3 dB frequency at  c = 1 that has to be denormalized to bring the 3 dB frequency to  c = 0.588148. Thus we get the denormalized transfer function as Applying bilinear transformation we get IIR Filter Design – Low Pass Filter (Example)

49 49 u13f8 IIR Filter Design – Low Pass Filter (Example)

50 50 We have dealt with the design of analog low pass filters in the past. Design of analog highpass, bandpass, and bandstop filters can be carried out by simple spectral transformations of the frequency variables. We denote the prototype low pass filter transfer function be H LP (s) and the desired analog filter transfer function be where Analog Filter – Highpass, Bandpass, and Bandstop

51 51 The spectral transformation is and thus we get where  p and are passband edge frequencies of prototype low pass and high pass filters. ss pp |H(j  )| Lowpass |H(j  )| Highpass 0 0  -- Analog Filter – High Pass

52 52 Design an analog Butterworth highpass filter with: passband edge at 4 kHz, stopband edge at 1 kHz, passband ripple of 0.1 dB, minimum stopband attenuation of 40 dB. For the prototype analog low pass filter we choose the normalized passband edge to be  p = 1. Thus, the stopband edge is Analog Filter – High Pass (Example)

53 53 We can use buttord to determine the order of the filter, N and the 3 dB cutoff frequency Wn of the low pass filter. Next we can either (1) use butter to determine H LP (s) of the prototype lowpass filter and then determine the coefficients of H HP (s) using lp2hp. (2) use butter directly to generate H HP (s) by indicating the type of filter to be ‘high’. u13f9 Analog Filter – High Pass (Example)

54 54 Example The spectral transformation is and thus we get where denotes the width of the passband It can also be shown that Design an analog elliptic bandpass filter with: passband edges at 4 kHz and 7 kHz, stopband edges at 3 kHz and 8 kHz, passband ripple of 1 dB, and a minimum stopband attenuation of 22 dB. (5) We choose to decrease to Analog Filter – Bandpass (Example)

55 55 The passband centre freq becomes  24 = 4.8989795 kHz. For the analog low pass prototype filter, we choose passband edge frequency  p = 1 and thus u13f10 Analog Filter – Bandpass (Example)

56 56 The spectral transformation is and thus we get where denotes the width of the stopband It can also be shown that The design of a bandstop filter is rather similar to a bandpass filter. Analog Filter – Bandstop


Download ppt "ME2300 DIGITAL SIGNAL PROCESSING [Slide 6] IIR Filter Design BY DREAMCATCHER COURSEWARE @ https://www.dreamcatcher.asia/cw"

Similar presentations


Ads by Google