Analog Filters: The Approximation Franco Maloberti Introduction The first step of the normalized filter design is to find a magnitude characteristics, |H(jw)|, that fulfills the specifications Handling |H(jw)| it is difficult. It is better to deal with |H(jw)|2. H( jw ) H(s)H(s) s jw H( jw )H * ( jw ) 2 |H(jw)|2 is a rationale function in w2 Franco Maloberti Analog Filters: The Approximation 2 Example Consider the transfer function s 2 H(s) 3 s 2s2 2s 3 (s 2)(s 2) s2 4 H(s)H(s) 3 6 2 3 2 (s 2s 2s 3)(s 2s 2s 3) s 8s2 9 w2 4 H( jw ) 6 w 8w 2 9 2 Much easier to deal than w2 4 H( jw) w 6 8w 2 9 2 Franco Maloberti Analog Filters: The Approximation 3 Methodology The approximation phase is based on the following: 2 Find a real rationale function in w capable to met the magnitude specifications (pass-band and stop-band) Live with the resulting phase response Correct (if necessary) the phase response (or delay) with a cascaded network Work on low-pass characteristics (we will se shortly how to achieve high-pass, band-pass, … from a low-pass TF) Franco Maloberti Analog Filters: The Approximation 4 Generic Low-Pass TF A generic form of a low-pass TF is: A0 H( jw ) 1 F(w 2 ) 2 F(w 2 ) 1 for 0 w w p F(w 2 ) 1 for w w p In the pass-band H(w)=A0 Franco Maloberti A0 Analog Filters: The Approximation wp 5 Butterworth Characteristics A very simple form for F(w2) is F(w 2 ) w 2n A0 H( jw ) 1 w 2n 2 n is the order of the Butterworth filter Properties: H( jw ) Max H( j0) 1 H( j1) Franco Maloberti 1 (3 dB or half power) 2 Analog Filters: The Approximation 6 Maximally Flat The magnitude response of the Butterworth filter is said to be maximally flat. H( jw) (1 w 2n )1/2 If we take the first 2n-1 derivatives of H(jw), they are all zero at w=0 1 0.9 0.8 0.7 0.6 n=8 w=0,…,2 0.5 0.4 0.3 0.2 0.1 0 Franco Maloberti 0 10 20 30 Analog Filters: The Approximation 40 50 60 70 80 90 100 7 Butterworth Plots; |H(jw)|2 clear all; omega=linspace(0,2,100); for k=1:6 n=k; for i=1:100 Butter(i,k)=1/(1+omega(i)^(2*n)); end end plot(omega,Butter); 1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 All curves cross 0.5 For w=1 Franco Maloberti 0.1 0 0 0.2 0.4 0.6 0.8 Analog Filters: The Approximation 1 1.2 1.4 1.6 1.8 2 8 Butterworth Plots For w>>1 |H(iw)|2 ≈ 1/(w2n) H(jw)|dB = -20 n log w 0 clear all; omega=linspace(0,100,100); for k=1:4 n=k; for i=1:100 Butter(i,k)=1/(1+omega(i)^(2*n)); ButdB(i,k) = 20* log10(Butter(i,k)); end end semilogx(omega,ButdB); Franco Maloberti -100 -200 -300 -400 -500 -600 -700 0 10 Analog Filters: The Approximation 10 1 10 2 9 Design of Butterworth filters Specifications dB s p |H(jw)|2 s 10log(1 w s2n ) p 10log(1 w 2n p ) w s2n 10 w 2n p s /10 p /10 10 1 1 s /10 w 10 1 s w 10 p /10 1 p 2n Franco Maloberti wp ws The values of s, p and the ratio ws/wp determine the order n of the filter. Analog Filters: The Approximation 10 Chebyshev Characteristics The Chebishev filters are based on the Chebishev polynomials Cn (w) cos(n cos1 w ) n is the order It is a polynomial! cos w cos1 w Cn (w ) cos(n ) Franco Maloberti Analog Filters: The Approximation 11 Chebyshev Polynomials Cn (w ) cos(n ) Cn 1(w ) cos(n ) cosn cos sin n sin Cn1(w ) cos(n ) cosn cos sin n sin Cn 1(w ) Cn1 (w ) 2cosn cos Cn (w ) w Cn 1 (w ) 2wCn (w ) Cn1(w ) Franco Maloberti Analog Filters: The Approximation 12 Chebyshev Polynomials C0 (w ) cos0 1 C1(w ) cos(cos1 w ) w C2 (w ) 2w 2 1 C3 (w ) 2(2w 2 1)w w 4w 3 3w C4 (w ) 2(4w 3 3w )w (2w 2 1) 8w 4 8w 2 1 Cn (w ) 2n1w n Franco Maloberti Analog Filters: The Approximation 13 Chebyshev Polynomials Features If w varies in the range -1 +1 Cn(w)=cos(n+) limited to the range -1 +1 If |w| is larger than 1 -1 w) increases monotonically Cn(w)=cosh(n cosh with wn. 15 10 clear all; n=7 xmax=1+5/n^2; w=linspace(-xmax,xmax,200); for i=1:200 C(i)=cos(n*acos(w(i))); end plot(w,C); 5 0 -5 -10 -15 -1.5 Franco Maloberti -1 -0.5 Analog Filters: The Approximation 0 0.5 1 1.5 14 Chebyshev low-pass Choose a small number e and let F(w 2 ) e 2Cn2 (w ) the low-pass transfer function is H( jw ) 2 1 1 e 2Cn2 (w ) Normalize wp = 1 Maximum attenuation in the pass-band 1 2 H( jw ) min 1 e 2 s 10log(1 e 2 ) Franco Maloberti Analog Filters: The Approximation 15 Chebyshev low-pass Plots 1 0.9 0.8 0.7 0.6 clear all; n = input('what is the order? '); eps = input('what is the value of epsilon? '); xmax=2; w=linspace(0,xmax,200); for i=1:200 C(i)=cos(n*acos(w(i))); H(i)=1/(1+(eps*C(i))^2); end plot(w,H); 0.5 Order 4 Eps=0.4 0.4 0.3 0.2 0.1 0 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 1 1.2 1.4 1.6 1.8 2 1 0.9 0.8 0.7 0.6 0.5 Order 7 Eps=0.2 0.4 0.3 0.2 0.1 0 Franco Maloberti 0 0.2 0.4 0.6 Analog Filters: The Approximation 0.8 16 Chebyshev Filter Design Start from specifications p 10log(1 e 2 ) |H(jw)|2 Determine e p /10 dB s p e 10 1 wp ws The order of the filter must be such that s 10log[1 e2Cn2 (ws / w p ))] Remember that Cn (w s / w p ) cosh(cosh1(w s / w p )) n Franco Maloberti cosh1[Cn (w s / w p )] cosh1 (w s / w p ) Analog Filters: The Approximation 17 Other Chebyshev Responses Define another function Ha ( jw) 1 H( jw) 2 2 Use in the Matlab program H(i)=1-1/(1+(eps*C(i))^2); 1 1 0.9 0.9 0.8 0.8 0.7 0.7 0.6 0.6 0.5 0.5 0.4 0.4 0.3 0.3 0.2 0.2 0.1 0.1 0 0 0.2 0.4 0.6 0.8 Franco Maloberti 1 1.2 1.4 1.6 1.8 2 0 0 0.2 0.4 Analog Filters: The Approximation 0.6 0.8 1 1.2 1.4 1.6 1.8 2 18 Inverse Chebyshev High-pass H b ( jw ) 2 1 1 e 2Cn2 (1 / w ) 1 clear all; n = input('what is the order? '); eps = input('what is epsilon? '); xmax=2; w=linspace(0,xmax,200); for i=1:200 C(i)=cos(n*acos((1/w(i)))); H(i)=1/(1+(eps*C(i))^2); end plot(w,H); 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 Franco Maloberti 0 0.2 0.4 0.6 Analog Filters: The Approximation 0.8 1 1.2 1.4 1.6 1.8 2 19 Inverse Chebyshev Low-pass H c ( jw ) 1 H b ( jw ) 1 2 2 1 1 e 2Cn2 (1 / w ) 1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 Franco Maloberti 0 0.5 1 1.5 2 2.5 3 Analog Filters: The Approximation 3.5 4 20 Elliptic-Function Butterworth and Chebyshev don’t have finite zeros All-pole functions Finite zeros help in the pass-band stop-band transition (see inverse Chebyshev) Hc ( jw ) 2 P( jw ) 2 Q( jw ) 2 Elliptic functions are a special category of zeropole transfer functions Franco Maloberti Analog Filters: The Approximation 21 Elliptic-Function (ii) Define RN(w) (w12 w 2 )(w 22 w 2 ) (w N2 w 2 ) RN (w ) (1 w12w 2 )(1 w 22w 2 ) (1 w N2 w 2 ) or w (w12 w 2 )(w 22 w 2 ) (w N2 w 2 ) RN (w ) (1 w12w 2 )(1 w 22w 2 ) (1 w N2 w 2 ) Poles and zeros are reciprocal of one another 2 If w1, w2,… are in the range 0 ≤ w ≤1 |R(w)| is zero at w1, w2,… and infinite at 1/w1, 1/w2,… Franco Maloberti Analog Filters: The Approximation 22 Elliptic-Function (iii) The elliptic characteristics is H( jw ) 2 1 1 e 2 RN2 (w ) Franco Maloberti Analog Filters: The Approximation 23 Plot of the Elliptic Function -6 3 1.0005 x 10 1 clear all; n=5; Stop eps=8; xmax=0.91; om1sq=0.1; Pass om2sq=0.4; om3sq=0.65; om4sq=0.8; omega=linspace(0,xmax,200); for i=1:200 w=omega(i); Num=w*(om1sq-w*w)*(om2sq-w*w)*(om3sq-w*w)*(om4sq-w*w); Den=(1-om1sq*w*w)*(1-om2sq*w*w)*(1-om3sq*w*w)*(1-om4sq*w*w); R(i)=Num/Den; Ellip(i)=1/(1+(eps*R(i))^2); end plot(omega,Ellip); 2.5 0.9995 2 0.999 0.9985 1.5 0.998 1 0.9975 0.997 0.5 0.9965 0.996 Franco Maloberti 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0 1.1 1.2 Analog Filters: The Approximation 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2 24 Determine the order of a Filter »help buttord BUTTORD Butterworth filter order selection. [N, Wn] = BUTTORD(Wp, Ws, Rp, Rs) returns the order N of the lowest order digital Butterworth filter that loses no more than Rp dB in the passband and has at least Rs dB of attenuation in the stopband. Wp and Ws are the passband and stopband edge frequencies, normalized from 0 to 1 (where 1 corresponds to pi radians). For example, Lowpass: Wp = .1, Ws = .2 Highpass: Wp = .2, Ws = .1 Bandpass: Wp = [.1 .8], Ws = [.2 .7] Bandstop: Wp = [.2 .7], Ws = [.1 .8] BUTTORD also returns Wn, the Butterworth natural frequency (or, the "3 dB frequency") to use with BUTTER to achieve the specifications. [N, Wn] = BUTTORD(Wp, Ws, Rp, Rs, 's') does the computation for an analog filter, in which case Wp and Ws are in radians/second. Franco Maloberti Analog Filters: The Approximation 25 Verification Butterorder clear all; omega=linspace(0,1.2,200); n=12; for i=1:200 Butterw(i)=1/(1+omega(i)^(2*n)); end plot(omega,Butterw); Wp=80; Rp=10*log10(Butterw(Wp+1)); Ws=180; Rs=10*log10(Butterw(Ws)); [N, Wn] = buttord(Wp, Ws, Rp, Rs, 's') 1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.2 0.4 0.6 0.8 1 1.2 1.4 »Butterorder N = 12 Wn = 166.7598 Franco Maloberti Analog Filters: The Approximation 26 Order of Chebishev or Elliptic filters [N, Wn] = CHEB1ORD(Wp, Ws, Rp, Rs, 's') does the computation for an analog filter, in which case Wp and Ws are in radians/second. [N, Wn] = ELLIPORD(Wp, Ws, Rp, Rs, 's') does the computation for an analog filter, in which case Wp and Ws are in radians/second. Comparing the orders clear all; Wp=2*pi; k=input('normalized stop frequency ') Ws=k*Wp; Rp=input('attenuation passband ') Rs=input('attenuation stopband ') [Nbutter, Wn] = BUTTORD (Wp, Ws, Rp, Rs, 's') [NCheb1, Wn] = CHEB1ORD(Wp, Ws, Rp, Rs, 's') [Nellip, Wn] = ELLIPORD(Wp, Ws, Rp, Rs, 's') Franco Maloberti »OrderFilter normalized stop frequency 1.2 attenuation passband 0.2 attenuation stopband 25 Nbutter = 25 Wn = 6.7203 NCheb1 = 9 Wn = 6.2832 Nellip = 5 Wn = 6.2832 Analog Filters: The Approximation 27 Butter and Cheb with same specs stop frequency 1.2 attenuation PB 0.2 dB attenuation SB 25 dB Nbutter = 25 Wn = 6.7203 NCheb1 = 9 Wn = 6.2832 1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 Franco Maloberti 0 0.5 1 1.5 Analog Filters: The Approximation 2 2.5 28 Butter and Cheb with same specs (ii) clear all; point=2000; range=2; omega=linspace(0,range,point)+range/2/point; n=25; m=9; eps=0.186; k=6.7203/6.2832; for i=1:point Butter(i)=1/(1+(omega(i)/k)^(2*n)); C(i)=cos(m*acos(omega(i))); Cheb(i)=1/(1+(eps*C(i))^2); end plot(omega,Butter,omega,Cheb); Butter(1000) Cheb(1000) Butter(1200) Cheb(1200) 1 0.99 0.98 0.97 0.96 0.95 0.94 0.93 0.92 0.91 0.9 0.9 Franco Maloberti 0.92 0.94 0.96 0.98 Analog Filters: The Approximation 1 1.02 1.04 1.06 1.08 1.1 29