13.2 Analog Elliptic Filter Design
Total Page:16
File Type:pdf, Size:1020Kb
CHAPTER 13 IIR FILTER DESIGN 13.2 Analog Elliptic Filter Design This document carries out design of an elliptic IIR lowpass analog filter. You define the following parameters: fp, the passband edge fs, the stopband edge frequency , the maximum ripple Mathcad then calculates the filter order and finds the zeros, poles, and coefficients for the filter transfer function. 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. 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 the lowest order polynomial (as opposed to elliptic) filters, see Section 14: Chebyshev Polynomials. Mathcad Implementation This document implements an analog elliptic lowpass filter design. The definitions below of elliptic functions are used throughout the document to calculate filter characteristics. Elliptic Function Definitions TOL ≡10−5 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 ϕ≡1i 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 First, the passband edge is normalized to 1 and the maximum passband response is set at one. Set the stopband edge and the maximum ripple in the passband and stopband. The filter order will be calculated from these constraints. Pass band edge: ωpp ≔1 Stop band edge: ωss ≔1.2 Pass band ripple: δ1 ≔.05 Stop band ripple: δ2 ≔.05 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=5 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.0673 odd≔mod(N,2) I≔if(odd,21, ) m≔0‥NI− ⎛ m ⎞ 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) ⎞ d ≔1mod− (N,2)+2⋅ floor ――――― l ⎝⎜ 2 ⎠⎟ KK ⎛ ⎛ 1 ⎞ ⎞ v≔―――⋅U⎜atan⎜―⎟,k'1⎟ NK⋅ ⎝⎛k1⎠⎞ ⎝ ⎝ ε ⎠ ⎠ ⎛ ⎛ d ⋅KK ⎞ ⎞ l sp ≔conj⎜1j⋅sn⎜――+1j⋅vk, ⎟,l⎟ l ⎝ ⎝ N ⎠ ⎠ Poles: Zeros: −14 ⎡−0.5162+3.6468i⋅ 10 ⎤ ⎡ −9 ⎤ ⎢ ⎥ 1.0941⋅ 10 +1.7229i −0.2768− 0.783i ⎢ −9 ⎥ ⎢ ⎥ −⋅1.0941 10 −1.7229i sp = −0.2768+ 0.783i sr =⎢ ⎥ l ⎢ ⎥ m −12 −0.0594− 1.0143i ⎢ −⋅1.658 10 +1.2333i ⎥ ⎢ ⎥ −12 ⎣−0.0594+ 1.0143i ⎦ ⎣⎢ 1.658⋅ 10 −1.2333i ⎦⎥ 2 1.6 1.2 0.8 0.4 Im⎛sp ⎞ ⎝ l⎠ 0 Im⎛sr ⎞ -0.4 m ⎝ ⎠ -0.8 -1.2 -1.6 -2 -0.55 -0.495 -0.44 -0.385 -0.33 -0.275 -0.22 -0.165 -0.11 -0.055 0 0.055 Re⎛sp ⎞ Re⎛sr ⎞ ⎝ l⎠ ⎝ m⎠ Fig. 13.2.1 Poles and zeros in the complex s-plane 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⎠ H(s)≔A⋅―m ――― ∏⎛ssp− ⎞ l l ⎝ ⎠ Define dB magnitude: dbm(ω)≔20⋅ log(|H(1j⋅ω)|) Frequency range to plot: ω≔0,‥ .01 3 1 0.9 0.8 0.7 0.6 0.5 | ( )| H 1j⋅ω 0.4 0.3 0.2 0.1 0 00.30.60.91.21.51.82.12.42.7 3 ω Fig. 13.2.2 Magnitude frequency response of filter 10 0 -10 -20 -30 -40 dbm(ω) -50 -60 -70 -80 -90 ω Fig. 13.2.3 Magnitude frequency response of filter in dB Polynomial Expansion Next expand the transfer function into Nth order polynomials in the numerator and denominator. The arrays num and den hold the coefficients of the numerator and denominator polynomials. The integral used to calculate these coefficients by Cauchy's formula will return accurate results when the order N is modest (say, less than 15), but the calculation is time-consuming. Numerator calculation: NUM(s)≔ ∏⎛ssr− ⎞ u ≔0‥NI− +1 m m ⎝ ⎠ 1 ⌠ ⌡NUM((exp(2j⋅π⋅x)))⋅cos(u⋅2⋅π⋅x) dx num ≔A⋅―0 ―――――――――――― u if(u=01.5, , ) Denominator calculation: DEN(s)≔ ∏⎛ssp− ⎞ w≔0‥N l l ⎝ ⎠ 1 ⌠ ⌡DEN((exp(2j⋅π⋅x)))⋅cos(w⋅2⋅π⋅x) dx den ≔―0 ―――――――――――― w if(w=01.5, , ) The numerator is The denominator is ∑⎛num ⋅su ⎞ ∑⎛den ⋅sw ⎞ u w u ⎝ ⎠ w ⎝ ⎠ ⎡ −14 ⎤ ⎡ ⎤ −0.3675+2.5967i⋅ 10 0 ⎢ −17 −17 ⎥ ⎢1⎥ ⎢9.1918⋅ 10 +3.6148i⋅ 10 ⎥ −10 u =⎢2⎥ num =⎢ −0.3654−1.5659i⋅ 10 ⎥ u ⎢ ⎥ −16 −17 3 ⎢1.0844⋅ 10 −4.0667i⋅ 10 ⎥ ⎣⎢4⎦⎥ ⎢ −10 ⎥ ⎣ −0.0814−1.0316i⋅ 10 ⎦ ⎡0⎤ ⎢1⎥ ⎢2⎥ ⎡ −14 ⎤ w= den = 0.3675−2.6201i⋅ 10 ⎢3⎥ w ⎣⎢ ⋮ ⎦⎥ ⎢4⎥ ⎣⎢5⎦⎥ In some cases, it may be desirable to specify a filter order, and calculate other terms in the design parameters. For example, if the filter order above is not meeting constraints closely enough, try an elliptic filter of a larger order. To calculate the magnitude of the ripple given the other constraints, follow the procedure below to calculate the k's. First, specify the filter order, N: ωp N≔6 k≔―p― k'≔ ‾1‾−‾k‾2‾ ωss ⎛ K(k') ⎞ r≔N⋅ ―― x≔.005 ⎝⎜ K(k) ⎠⎟ ⎛ ⎛ ⎛ ⎞⎞ ⎞ K⎝Re⎝ ‾1‾−‾x‾2‾⎠⎠ k ≔root⎜――――――−rx, ⎟ 1 ⎝ K(x) ⎠ ‾‾‾‾2‾ k'1 ≔ 1−k1 −9 −9 check≔k'<110− =1 check1 ≔k'1 <110− =1 Now if, for example, the stopband ripple is given, we can calculate the minimal passband ripple as follows: ‾‾1‾‾‾‾ 1 δ =0.05 ε≔k ⋅ ――−1 δ ≔1−――― 2 1 2 1 ‾‾‾‾2 ‾ δ2 1+ε The minimal passband ripple is: δ1 =0.0005.