Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.341:DISCRETE-TIME SIGNAL PROCESSING OpenCourseWare 2006 Lecture 8 DT Filter Design:IIR.Filters Reading:Section 7.1 in Oppenheim,Schafer Buck (OSB). In the last lecture we studied various forms of filter realizations.Today we will take one step back,focusing our attention on determining the actual transfer functions to be realized. Given specifications of the desired properties of the system,we approximate the specifications using a causal discrete time system.In this lecture,we will show how IIR systems can be approximated by rational functions of z.Next time we will look at FIR system approximation using polynomials of z. So far,we have tended to make reference only to ideal filters.In practical designs,ideal sys- tems can not be realized exactly,since the impulse responses are infinitely long and non-causal. The idea is to approximate the desired frequency response within certain error tolerances.As such,specifications are usually given as tolerance levels in different frequency bands in the range 0≤w≤π.OSB Figure7.2 gives a sample tolerance scheme.The transition band is a“don't care"region in which the filter gain can be any finite value.Notice that no requirements have been specified for the phase response of the system.Typical filter design procedures focus only on magnitude approximation: Hideal((e")=lH(e)leit)→lHef(e“l≈Hideal(=lHe“l. Nonetheless,specifications can involve both magnitude and phase(or group delay).Such gen- eralized approximation is a harder problem,but may be desired in specific applications.In particular,integer or fractional delays can only be achieved with FIR filters. Most of our following discussions will be phrased for piecewise constant LPF's.Keep in mind,however,that much applies more generally,since specific transformations can convert LPF's to HP,BP,or notch filters. IIR vs.FIR Given a set of specifications,first we need to decide if the desired filter should be IIR or FIR. The following table summarizes different factors that could be considered when making this decision: 1
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.341: Discrete-Time Signal Processing OpenCourseWare 2006 Lecture 8 DT Filter Design: IIR Filters Reading: Section 7.1 in Oppenheim, Schafer & Buck (OSB). In the last lecture we studied various forms of filter realizations. Today we will take one step back, focusing our attention on determining the actual transfer functions to be realized. Given specifications of the desired properties of the system, we approximate the specifications using a causal discrete time system. In this lecture, we will show how IIR systems can be approximated by rational functions of z. Next time we will look at FIR system approximation using polynomials of z. So far, we have tended to make reference only to ideal filters. In practical designs, ideal systems can not be realized exactly, since the impulse responses are infinitely long and non-causal. The idea is to approximate the desired frequency response within certain error tolerances. As such, specifications are usually given as tolerance levels in different frequency bands in the range 0 ≤ ω ≤ π. OSB Figure 7.2 gives a sample tolerance scheme. The transition band is a “don’t care” region in which the filter gain can be any finite value. Notice that no requirements have been specified for the phase response of the system. Typical filter design procedures focus only on magnitude approximation: Hideal(ejω) = |H(ejω) ejθ(ω) |Heff(ejω) Hideal(ejω) | = H(ejω | → | ≈ | | |) . Nonetheless, specifications can involve both magnitude and phase (or group delay). Such generalized approximation is a harder problem, but may be desired in specific applications. In particular, integer or fractional delays can only be achieved with FIR filters. Most of our following discussions will be phrased for piecewise constant LPF’s. Keep in mind, however, that much applies more generally, since specific transformations can convert LPF’s to HP, BP, or notch filters. IIR vs. FIR Given a set of specifications, first we need to decide if the desired filter should be IIR or FIR. The following table summarizes different factors that could be considered when making this decision: 1
IIR Filters FIR Filters Phase difficult to control,no particular linear phase always possible (grp delay) techniques available Stability can be unstable, always stable, can have limit cycles no limit cycles Order less more History derived from analog filters no analog history Others polyphase implementation possible can always be made causal The only way to achieve integer or fractional constant delays is by using FIR filters. Limit cycles are instability of a particular type due to quantization,which is severely non-linear. The number of arithmetic operations needed per unit time is directly related to filter order.#MAD stands for number of multiplications and additions.When using this as a criterion for comparing different filters,one should pay attention to whether the #MAD is measured per input sample,per output sample,or per unit time(clock cycle).It is possible that an IIR of lower order actually requires more #MAD than an FIR of higher order,because FIR filters may be implemented using polyphase structures. Different conventions exist for specifying magnitude responses for IIR and FIR filters. In particular,IIR filter specs are normalized to [1-A1,1](dB)in the passband,and [-oo,A2](dB)in the stopband;FIR filter specs are normalized to between 1+61 within the passband,and t62 in the stopband,where 01,62 are given as decimals. IIR Filter Design Historically,digital IIR filters have been derived from their analog counterparts.There are several common types of analog filters:Butterworth which have maximally flat passbands in filters of the same order,Chebyshev type I which are equiripple in the passband,Chebyshev type II which are equiripple in the stopband,and Elliptic filters which are equiripple in both the passband and the stopband.The digital version of these can be obtained from analog designs through the bilinear transformation,discussed in detail in OSB Sections 7.1.2 and 7.1.3. In short,the bilinear transformation is an algebraic mapping from the continuous frequency variable s to the discrete frequency variable z such that the imaginary axis in the s-plane corresponds to one revolution of the unit circle in the z-plane: 、1-z-1 .2w2 →j0=j斤tan2 tanw/2 8一1+27 n2’e tanwe/2 r in the digital frequency domain corresponds to infinity in the analog frequency domain.Note that the bilinear transformation is really only appropriate in mapping filters which approximate piecewise constant filters. 2
IIR Filters FIR Filters Phase difficult to control, no particular linear phase always possible (grp delay) techniques available Stability can be unstable, always stable, can have limit cycles no limit cycles Order less more History derived from analog filters no analog history Others polyphase implementation possible can always be made causal • The only way to achieve integer or fractional constant delays is by using FIR filters. • Limit cycles are instability of a particular type due to quantization, which is severely non-linear. • The number of arithmetic operations needed per unit time is directly related to filter order. #MAD stands for number of multiplications and additions. When using this as a criterion for comparing different filters, one should pay attention to whether the #MAD is measured per input sample, per output sample, or per unit time (clock cycle). It is possible that an IIR of lower order actually requires more #MAD than an FIR of higher order, because FIR filters may be implemented using polyphase structures. • Different conventions exist for specifying magnitude responses for IIR and FIR filters. In particular, IIR filter specs are normalized to [1 − Δ1, 1](dB) in the passband, and [−∞, Δ2](dB) in the stopband; FIR filter specs are normalized to between 1 ± δ1 within the passband, and ±δ2 in the stopband, where δ1, δ2 are given as decimals. IIR Filter Design Historically, digital IIR filters have been derived from their analog counterparts. There are several common types of analog filters: Butterworth which have maximally flat passbands in filters of the same order, Chebyshev type I which are equiripple in the passband, Chebyshev type II which are equiripple in the stopband, and Elliptic filters which are equiripple in both the passband and the stopband. The digital version of these can be obtained from analog designs through the bilinear transformation, discussed in detail in OSB Sections 7.1.2 and 7.1.3. In short, the bilinear transformation is an algebraic mapping from the continuous frequency variable s to the discrete frequency variable z such that the imaginary axis in the s-plane corresponds to one revolution of the unit circle in the z-plane: 1 − z−1 2 ω Ω tan ω/2 s → 1 + z−1 ⇒ jΩ = j tan 2 , T Ωc → tan ωc/2 π in the digital frequency domain corresponds to infinity in the analog frequency domain. Note that the bilinear transformation is really only appropriate in mapping filters which approximate piecewise constant filters. 2
Butterworth Filters Two design parameters:order of the filter N,cutoff frequency we.The squared magnitude response of a Butterworth filter has the following form: 1 HBw(ex)2= 1+ tan(w/2)2N tan (we/2) The tan function arises here because of the bilinear transformation.In the analog case, the transfer function is in the form of 1/1+()2.See Appendix B.1 of OSB for analog Butterworth filter design techniques. The magnitude response of a Butterworth filter decreases monotonically with frequency. The order of the system can be estimated by examining the desired filter gain at the cut-off frequency. Integer round up may be required in estimating the order of the system.Specs are therefore often exceeded at the passband and stopband edges.In addition,the specs are often much exceeded in the stopband,with attenuation approaching zero (-oodB)as frequency approaches m.This is because all zeros of the system are located at z=-1. Since the gain diminishes quickly as frequency increases.It is possible that a lower order filter exists such that it satisfies the given specifications,but does not exceed them as greatly as the Butterworth design. The following sets of figures are examples of Butterworth filter design.For an additional example,see OSB Example 7.4. 3
Butterworth Filters • Two design parameters: order of the filter N, cutoff frequency ωc. The squared magnitude response of a Butterworth filter has the following form: 1 2 |HBW (e = jω)| 1 + � tan (ω/2) �2N tan (ωc/2) The tan function arises here because of the bilinear transformation. In the analog case, the transfer function is in the form of 1/1 + ( Ω )2N . See Appendix B.1 of OSB for analog Ωc Butterworth filter design techniques. • The magnitude response of a Butterworth filter decreases monotonically with frequency. The order of the system can be estimated by examining the desired filter gain at the cut-off frequency. • Integer round up may be required in estimating the order of the system. Specs are therefore often exceeded at the passband and stopband edges. In addition, the specs are often much exceeded in the stopband, with attenuation approaching zero (−∞dB) as frequency approaches π. This is because all zeros of the system are located at z = −1. Since the gain diminishes quickly as frequency increases. It is possible that a lower order filter exists such that it satisfies the given specifications, but does not exceed them as greatly as the Butterworth design. • The following sets of figures are examples of Butterworth filter design. For an additional example, see OSB Example 7.4. 3
Butterworth Filter,14th Order Butterworth Filter,14th Order Pale-zero plo -10 -20 - 40 -5n /2 34 Froquency, 1-05005 34 02 4 2 34 20 Frequancy. Time,n Fig Pole-Zero Plot,Respese Design Sp and edge=0.5x +Filter doesn't meet this spec Patshand edge =0.5x. +Fulter doesn't meet this spec 4.Minimm passhand gnin =-03dB Filte知dosn生et thiss0e Filter doesn't meet this spc 5.Maximum stophand gain -30 dB. 5.Maximm stophand gain =-30 dB. Butterworth Filter,15th Order Butterworth Filter,15th Order Pole-zero plat 10 ,2 05 -40 3/4 -0.5 Impulse Response 3/4 0.3 0.2 0.1 -0.1 34 40 2 Frequency.● FigrePule-ro Plot,Response FigumMagitde Plot,Paosband Detaal,Group Delay Design Spocifications 1.Passhand edge =05 1.Passband edge =0.5m. 2.Stophand edge =0.6m 2.Stopband edge =0.6r. Maximum passbaund gain0 dB. Maximm passhand gain =0 dB. 报 45 Minimum passband gain =-0.3 dB. Maximum stopband gain =-30 dB. 4
4
Direct form implementation of a Butterworth filter may cause instability because of coef- ficient quantization.The poles may move to the outside of the unit circle,and the zeros may spread around z=-1 as shown in the next figure.A solution is to use a cascade structure of first and second order systems,with zeros and poles grouped into complex conjugate pairs.Furthermore,since all of the zeros are located at z=-1,the numerator of the transfer function is(1+1)N.No multiplication is actually needed to implement the zeros,because this is equivalent to the cascade of N "delay and add"operations. Butterworth Filter,15th Order Pole-zero plot -1-050 05 Impulse Response 02 20 30 Time.n Figure 2 Pole-Zero Plot,Response Design Specifications: 5.Maximum stophand gain =-30 dB Chebyshev Filters Type I HCH(ej)2= 1+2V tan (w/2) tan (wc/2) Three design parameters:order N,PB cut-off frequency we,allowed PB ripple e(ie.the maximum allowable passband gain is 1,and the minimum allowable passband gain is (1-e). VN(z)=cos(N cos-1z)is the Nth-order chebyshev polynomial.Here we take the con- vention that cos-1x becomes the inverse hyperbolic cosine and is imaginary if >1. 5
• Direct form implementation of a Butterworth filter may cause instability because of coef ficient quantization. The poles may move to the outside of the unit circle, and the zeros may spread around z = −1 as shown in the next figure. A solution is to use a cascade structure of first and second order systems, with zeros and poles grouped into complex conjugate pairs. Furthermore, since all of the zeros are located at z = −1, the numerator of the transfer function is (1 + z−1)N . No multiplication is actually needed to implement the zeros, because this is equivalent to the cascade of N “delay and add” operations. Chebyshev Filters Type I 1 2 |HCH(e = jω)| � tan (ω/2) � 1 + �2V 2 N tan (ωc/2) • Three design parameters: order N, PB cut-off frequency ωc, allowed PB ripple � (ie. the maximum allowable passband gain is 1, and the minimum allowable passband gain is (1 − �)). VN (x) = cos(N cos−1 • x) is the Nth-order chebyshev polynomial. Here we take the convention that cos−1 x becomes the inverse hyperbolic cosine and is imaginary if | | x > 1. 5
Some examples of lower order Chebyshev polynomials are: 6(x)=1 Vi(z)=z V2(z)=cos(2 cos-1 z)=2cos2(cos-1x)-1=2x2-1 See Appendix B.2 of OSB for recurrence formulas for deriving Chebyshev polynomials. Equiripple in the passband,but decreases monotonically in the stopband. Similar to Butterworth filters,all zeros of a Chebyshev type I filter are located at z=-1. Following is a design example: Chebyshev Type I Filter,7th Order Chebyshev Type I Filter,7th Order Pole-zero plot 10 7产order29ro 0.5 兽-20 30 40 4 2 34 Frequency.m -10.5 Impulse Response 0.5 0.4 4 0.2 3/4 2 40 Time. Figre Magnitude Plot,Passband Detail,Group Delay :Pole-Ze Plot,Response n 2.Stopband edge =0.6m. 2 Stopband edre 3.Maximum passband gain =0 dB. 3.Maximum sshand gain =0 dB. 4.Minimum passband gain =-0.3 dB. 5.Maximum stopband gain =-30 dB. Type II 1 HCH(ejw)2= 1+(高号)厂 Monotonic in the passband;equiripple in the stopband. For a given set of specifications,the Chebyshev type I and Chebyshev type II design methods yield the same order. 6
examples of lower order Chebyshev polynomials are: V0(x) = 1 V1(x) = x V2(x) = cos(2 cos−1 x) = 2 cos2(cos−1 x) − 1 = 2x2 − 1 Appendix B.2 of OSB for recurrence formulas for deriving Chebyshev polynomials. in the passband, but decreases monotonically in the stopband. to Butterworth filters, all zeros of a Chebyshev type I filter are located at z = −1. wing is a design example: Some Equiripple Similar Follo See • • Type II |HCH(ejω) 2 1 � tan (ω/2) ��−1 | = 1 + � �2V 2 N tan (ωc/2) • Monotonic in the passband; equiripple in the stopband. • For a given set of specifications, the Chebyshev type I and Chebyshev type II design methods yield the same order. 6
As shown in the figures below,poles are distributed around z=1,similar to Butterworth designs,while zeros are arrayed on the unit circle at the stopband frequencies.Because zeros are not all located at z=-1,more multiplications are required in comparison to Chebyshev type I designs.OSB Example 7.5 compares Chebyshev type I and II filters in more detail. Chebyshev Type II Filter,7th Order Chebyshev Type II Filter,7th Order Pole-zero plot -1o4 号-204 -304 -40 -50 2 -1-0.5005 Impulse Response 4 34 2 34 20 30 Time,n Figre Magitude Plot,Detail,Group Deln 10:Pole-Zero Plot,Impulse Respon Design Specifications: Design Specifications nd edge =0.57. Passhand edge =0.5m. 2 Stopband edge =0.6. dann eage =0.0 gin =0 dB 二-30dB 5.Maximumn stopbsnd gain =-30 dB. In both of the Chebyshev design methods,having a monotonic behavior in either the passband or the stopband suggests a lower order system might exist such that it satisfies the given set of specifications,but varies with equal ripple in both the passband and the stopband. Elliptic Filters Four degrees of freedom:PB ripple,SB ripple,order,passband edge. Order of the system controls the transition bandwidth. Equiripple in both the passband and the stopband. Elliptic filters are the lowest order rational function approximation to a given set of magnitude specifications.All IIR filter designs we have discussed so far give nonlinear 7
wn in the figures below, poles are distributed around z = 1, similar to Butterworth while zeros are arrayed on the unit circle at the stopband frequencies. Because are not all located at z = −1, more multiplications are required in comparison to yshev type I designs. OSB Example 7.5 compares Chebyshev type I and II filters in detail. • designs, zeros Cheb more As sho • In both of the Chebyshev design methods, having a monotonic behavior in either the passband or the stopband suggests a lower order system might exist such that it satisfies the given set of specifications, but varies with equal ripple in both the passband and the stopband. Elliptic Filters • Four degrees of freedom: PB ripple, SB ripple, order, passband edge. • Order of the system controls the transition bandwidth. • Equiripple in both the passband and the stopband. • Elliptic filters are the lowest order rational function approximation to a given set of magnitude specifications. All IIR filter designs we have discussed so far give nonlinear 7
phases,thus non-constant group delays.The greatest deviation from constant group delay occurs in all cases at either the edge of the passband,or within the transition band.In general,the Chebyshev type II approximation gives the smallest delay in the passband, and the widest region of the passband over which the delay is approximately constant. However,if constant group delay is not required,the elliptic approximation gives the lowest order system function. Following are some sample elliptic filter designs.Also see OSB Example 7.6. Elliptic Filter,sth Order Exceeds Design Specifications Elliptic Filter,5th Order Pole-zero plot 号-20 28 无4 元2 34 -0.5 0.5 Imputse Response 0.2 0. 4 2 34 m,n 20 Froquency,o Figre 1:Magnitede Plot Passband Detsil,Group Dey Figure Pole-Zero Plot,Impulse Respose 2.Stopband edge 0.6m. 3.Maximum passband gain =0 dB. 5 Maximum passband gain0dB. -30dB 8
thus non-constant group delays. The greatest deviation from constant group delay in all cases at either the edge of the passband, or within the transition band. In the Chebyshev type II approximation gives the smallest delay in the passband, widest region of the passband over which the delay is approximately constant. er, if constant group delay is not required, the elliptic approximation gives the order system function. • are some sample elliptic filter designs. Also see OSB Example 7.6. phases, general, occurs and the Howev lowest Following 8
Elliptic Filter,5th Order Elliptic Filter,5th Order Minimizing Stopband Edge Frequency Minimizing Stopband Edge Frequency Pole-zero plot -10 -20 -40 无4 无2 34 Frequency, -0.5 0.5 Impulse Response 2 34 0. 4 /2 04 20 Fraquency.w ime, Pole-Zero Piot, Specifications Met: opband =0dB 0d 4.Minimum passband gain =-0.3 dB. Maximam stooband gain =-30 dB 5.Maximum stophand gain =-30 dB. Elliptie Filter,5th Order nd Gain Maximizing Minimum Passband Gain Pole-zero plot 9-20 40 4 元2 34 4 2 20 5 3.Maximum pas hand gain =0dB. nd gain =-0.017 dB. 9
9
Elliptic Filter,5th Order ng Maximum Stopband Gain Minimizing Maximum Stopband Gain Pole-zero plot -10 男-20 -30 50 4 元2 3n4 0.5 2 34 02 -0.2 4 2 34 20 0 Floue 18:Pode-Zeto Plat ons Met 3. Maximum parsband gain =0 dB. Maximum stopband gain =-43 dB mum stopbxand gain =-43 10
10