13.3 Digital Elliptic Filter Design
Total Page:16
File Type:pdf, Size:1020Kb
CHAPTER 13 IIR FILTER DESIGN 13.3 Digital Elliptic Filter Design This document carries out design of a discrete-time elliptic lowpass filter. The user specifies the following parameters: passband edge, passband and stopband ripple, and filter order. T, the sampling rate fp, the passband edge frequency fs, the stopband edge frequency , the maximum ripple Mathcad then calculates the remaining parameters and finds the zeros, poles, and coefficients for the filter transfer function. This procedure begins by computing the transfer function for a corresponding analog filter and then transforms the poles and roots of this function to produce the digital filter transfer function required. For more information on the bilinear transformation used in this application, see Section 13.1: Analog/Digital Lowpass Butterworth Filter. Background Elliptic filters, so called because they employ elliptic functions to generate the filter function, are useful because they have equiripple characteristics in the pass and stopband regions. This ensures that the lowest order filter can be used to meet design constraints. Elliptic filters, like all other lowpass filters, are feedback systems. All of the usual stability rules for feedback systems in the z-domain apply. Elliptic filters have all their zeros on the unit circle, and all their poles within the unit circle. For information on how to transform a continuous-time IIR filter to a discrete-time IIR filter, see Section 13.1: Analog/Digital Lowpass Butterworth Filter. For information on analog elliptical filter design, see Section 13.2: Analog Elliptic Filter Design. Mathcad Implementation This document implements a digital elliptic lowpass filter design. The definitions below of elliptic functions are used throughout the document to calculate filter characteristics. Elliptic Function Definitions TOL ≡10−4 Im (ϕ) Re (ϕ) ⌠ 1 ⌠ 1 U(ϕ,k)≡1i⋅ ⎮――――――dy+ ⎮―――――――――dy ‾‾‾‾‾‾‾‾‾‾‾‾2‾ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾2‾ ⎮ 2 ⎮ 2 ⌡ 1−k ⋅sin(1j⋅y) ⌡ 1−k ⋅sin(1j⋅ Im(ϕ)+y) 0 0 ϕ≡11i+ sn(uk, )≡sin(root(U(ϕ,k)−u,ϕ)) π ― 2 ⌠ 1 L(k)≡⎮――――――dy ‾‾‾‾‾‾‾‾‾‾2‾ ⎮ 2 ⌡ 1−k ⋅sin(y) 0 ⎛⎛ ⎞⎞ 2 1− ‾1‾−‾k‾2‾ V(k)≡――――⋅L⎜⎜――――⎟⎟ 1+ ‾1‾−‾k‾2‾ ⎝⎜⎝⎜ 1+ ‾1‾−‾k‾2‾⎠⎟⎠⎟ K(k)≡if(k<.9999,L(k),V(k)) Design Specifications Sampling interval in seconds: T≔.001 1 implies a bandlimit (Hz) of: f ≔――=500 max 2⋅T Pass band edge in Hz: fp ≔100 Stop band edge in Hz: fs ≔105 Pass band ripple: δ1 ≔.05 Stop band ripple: δ2 ≔.05 Pass band edge is normalized to one: ωpp ≔1 2 ―⋅tan⎝⎛π⋅f ⋅T⎠⎞ For digital design, prewarp the stopband T s ωs ≔―――――=1.0537 edge to the corresponding analog value. s 2 ―⋅tan⎝⎛π⋅f ⋅T⎠⎞ T p Calculation of Filter Order Definitions of moduli: ‾‾2‾⋅‾δ‾−‾‾δ‾2‾‾‾ ε≔ ――1 ―1―― 2 1−2⋅δ1 +δ1 ε ‾‾‾‾2‾ k1 ≔――― k'1 ≔ 1−k1 ‾‾1‾‾‾‾ ――−1 2 δ2 ωp k≔―p― k'≔ ‾1‾−‾k‾2‾ ωss For correct calculations, check to see that k and k' are not too close to 1. For accuracy, they should be less than 1 - 10-9. −9 −9 check≔k<110− =1 check1 ≔k'1 <110− =1 ⎛ K(k)⋅K⎝⎛k'1⎠⎞ ⎞ N≔ceil⎜――――⎟ ⎝ K(k')⋅K⎝⎛k1⎠⎞ ⎠ The minimum filter order is: N=6 Finding the Zeros and Poles of the Transfer Function Zeros and poles of the transfer function are calculated using the elliptic functions. If the filter order is odd, there will be one real pole of order 1, in addition to several complex conjugate poles. KK≔K(k)=2.581 odd≔mod(N,2) I≔if(odd,21, ) ⎛ m ⎞ m≔0‥NI− c ≔I+2⋅ floor ― m ⎝⎜ 2 ⎠⎟ m ⎝⎛−1⎠⎞ ⋅1j sr ≔――――― m ⎛ KK ⎞ ksn⋅ c ⋅――,k ⎝⎜ m N ⎠⎟ l≔0‥N−1 conj(zl, )≔if⎝⎛mod(l,2)=0,z,‾z⎠⎞ ⎛ l+mod(N,2) ⎞ KK ⎛ ⎛ 1 ⎞ ⎞ d ≔1mod− (N,2)+2⋅ floor ――――― v≔―――⋅U atan ―,k'1 =0.5015 l ⎜ ⎟ ⎜ ⎜ ⎟ ⎟ ⎝ 2 ⎠ NK⋅ ⎝⎛k1⎠⎞ ⎝ ⎝ ε ⎠ ⎠ ⎛ ⎛ d ⋅KK ⎞ ⎞ l sp ≔conj⎜1j⋅sn⎜――+1j⋅vk, ⎟,l⎟ l ⎝ ⎝ N ⎠ ⎠ Analog Transfer Function Use the poles and zeros of the system to construct the transfer function. It will be written as a factored expression of each pole and zero in the form (s - p1)(s - p2)(...), etc.. ∏sp l l A≔if⎝⎛mod(N,2)=0,1−δ1 ,1⎠⎞⋅―― ∏sr m m The transfer function, H, normalized so that max H(j ) = 1: ∏⎛ssr− ⎞ m m ⎝ ⎠ Hs (s)≔A⋅―――― ∏⎛ssp− ⎞ l l ⎝ ⎠ Digital Transfer Function When you have calculated the roots and poles of the analog transfer function, the corresponding digital transfer function is given by 1 ⎛ z−1 ⎞ ( ) q≔―――― H(z)≔Hs ⎜q⋅――⎟ tan⎝⎛π⋅fp ⋅T⎠⎞ ⎝ z+1 ⎠ 1 f≔0‥―― 2⋅T 1.1 1 0.9 0.8 0.7 0.6 |H(exp(2j⋅π⋅fT⋅ ))| 0.5 0.4 0.3 0.2 0.1 0 02040 60 80 100 120 140 160 180 200 f Fig. 13.3.1 Frequency response of the digital transfer function Check magnitude at passband and stopband edges: |H⎝⎛exp⎝⎛2j⋅π⋅fp ⋅T⎠⎞⎠⎞|=0.95 |H⎝⎛exp⎝⎛2j⋅π⋅fs ⋅T⎠⎞⎠⎞|=0.0337 The zeros are qsr+ ⎛ qsr+ ⎞ m N − 1 a ≔――― a ≔if⎜odd,−1,―――⎟ m qsr− N − 1 ⎜ qsr− ⎟ m ⎝ N − 1 ⎠ The poles are qsp+ l b ≔―― l qsp− l 1.25 1 0.75 0.5 Im⎛b ⎞ 0.25 ⎝ l⎠ 0 Im⎛a ⎞ ⎝ l⎠ -0.25 Im⎝⎛e1j⋅ 4 ⋅ π ⋅ fT⋅ ⎠⎞ -0.5 -0.75 -1 -1.25 -1.25 -1 -0.75 -0.5 -0.25 0 0.25 0.5 0.75 1 1.25 Re⎛b ⎞ Re⎛a ⎞ Re⎝⎛e1j⋅ 4 ⋅ π ⋅ fT⋅ ⎠⎞ ⎝ l⎠ ⎝ l⎠ Fig. 13.3.2 Poles and zeros of the filter in the z-plane Polynomial Expansion To expand the transfer function into an Nth order polynomial, find the transfer function coefficients for numerator and denominator, and integrate according to Cauchy's theorem: HNUM(s)≔ ∏⎛sa− ⎞ l l ⎝ ⎠ HDEN(s)≔ ∏⎛sb− ⎞ l l ⎝ ⎠ Multiplying numerator coefficients by B will normalize H so that at frequency zero the response is 1 for N odd or 1 - for N even. HDEN(1) B≔――――⋅if⎝⎛odd,1,1−δ ⎠⎞ w≔0‥N HNUM(1) 1 1 ⌠ ⌡HNUM((exp(2j⋅π⋅x)))⋅cos(w⋅2⋅π⋅x) dx hnum ≔B⋅―0 ―――――――――――― w if(w=01.5, , ) 1 ⌠ ⌡HDEN((exp(2j⋅π⋅x)))⋅cos(w⋅2⋅π⋅x) dx hden ≔―0 ―――――――――――― w if(w=01.5, , ) Numerator Denominator coefficients: coefficients: ⎡ −12 ⎤ −16 0.043+9.775i⋅ 10 ⎡ + ⋅ ⎤ ⎡ ⎤ 0.48 8.882i 10 0 ⎢ −11 ⎥ ⎢ −16 ⎥ −0.144−4.98i⋅ 10 −2.849−8.882i⋅ 10 ⎢1⎥ ⎢ ⎥ ⎢ ⎥ −10 −16 ⎢2⎥ ⎢ 0.27+1.132i⋅ 10 ⎥ ⎢ 7.421−8.882i⋅ 10 ⎥ −10 w=⎢3⎥ hnum =⎢−0.321−1.464i⋅ 10 ⎥ hden =⎢−10.83 ⎥ w w ⎢ ⎥ ⎢ −10 ⎥ −16 4 0.27+1.132i⋅ 10 ⎢ 9.365−4.441i⋅ 10 ⎥ ⎢ ⎥ 5 ⎢ −11 ⎥ ⎢ −15 ⎥ −0.144−4.98i⋅ 10 −4.571−3.851i⋅ 10 ⎣⎢6⎦⎥ ⎢ ⎥ ⎢ ⎥ ⎣ 0.043+9.775i⋅ 10−12 ⎦ ⎣ 1+1.069i⋅ 10−15 ⎦.