Professional Documents
Culture Documents
Filterbookproakis
Filterbookproakis
Filter length of 5 has been reinforced by defining rectangul Reader must observe that h(n) = h(n). xn), and in this case with the view of obtaining a causal filter directly, unlike in the previous examp! ue )Nu) =hyay=—1 sin( = ) =0.22519 ” 4 Fe ctangular wit pa SUA WindOW, Way (0) = Wyey(1) = Wye (2)= West 3) = Wee =! h(n) =hy(n) - eo(n)Solved Examples and MATLAB Solutions 1107 (0) =h(4) = hy(0) : Wyee(0) = 0.15923 1 = 0.15923 (1) =h(3)=hy(1) - Wye 1) = 0.22519 = 0.22519 ad (2) =hg(2) Wygee(2) = 0.25 x 1 = 0.25 Thi us causal filter has H(z) = 0.159232" + 0.225192"! +0.252? + 0.225192" + 0.159232 4 Now frequency response, H(w) =}, h(nje™*" a0 = h(0)e+ h( e+ h(2)e78+ h(3)eF?+ hime? PO (p (0) (28+ e?%) + h(1) (e+ 27) + h(2)] © [h (2) + 2h(0) cos 2@+ 2h(1) cos O] = ¢?#{0.25 + 0.31847 cos 2 «+ 0.45038 cos 0] Frequency response could be obtained directly for M odd oe SYP (M-1) 4 = M Ma =e? (Wes }+2 z menpeose[ Bi =o P® [h(2) + 2h(0) cos 2+ 2h (1) cos @] ase O >% Program for computing low pas: normalised by 10, ie fs/2 gives 0.35 sefc = 0.35; % fe = (2+7)/2=3.5, >> N= 215 >> hn= firl((N-1), fc, hanning(N)) tn = Columns 1 through 5 -0.00064381414496 -0.00127273 0.00702084138692 Columns 6 through 10 .02567621285315 -0.05348848328662 -0.01371522034307 0.11837810768514 0.27749473394416 Columns 11 through 15 0. 34952485482004 0.27749473394416 0.11837810768514 -0.01371522034307 - 0.05348848328662 Columns 16 through 20 -0.02567621285315 0.00702084138692 0.01310990957519 0.00403044705778 - 0.00127273643142 Column 21 -0,00064381414496 643142 0.00403044705778 0. 1310990957519 Example 23 Design a lowpass filter to meet the following specifications: Passband edge = 1.5 kHz uansition width = 0.5 kHz, stopband attenuation > 55 dB and F,= 10kHz Solution Given/,~ 1.5 kHz Therefore,Solved Examples and MATLAB Solutions 1114 2nx500 A= —— =0.314 so Af= 0.05, 0, = 1.256 Also, 0. to @,= to = 1.099 so Jf.= 0.175 (normalised) attenuati ion of upto 58 dB can be obtained using Blackman window. For Blackman window ape 33 ~ M Thus, length of filter m= 23 267 0.05 2f,sin(n@,) wom ho = | nt ne0 335033 ze -n=0 ForBlackman window, @(n) = 0.42+0.5008 (225) + o0bo{ sz) 335533 =I M-1 a For window operation we have A(n) = hgln): O(n) Since h(n) is symmetrical, we only need to compute h(n) for0 % o> fc = 0.175; % normalised fs/2 >> N= 67; >> hn = firl((N-1), fc, blackman(N)) in = Columns 1 through 7 0.0000 = 0.0000 0.0000 Columns 8 through 14 —0,0002 0.0006 0.0010 Columns 15 through 21 0.0034 0.0039 ~~ - 0.0009 Columns 22 through 28 0.0090 = 0.0083 - 0.0218 Columns 29 through 35 -0.0410 -0.0713 -0.0161 Columns 36 through 42 0.1269 = -0.0161 - 0.0713 Columns 43 through 49 ~ 0.0118 —-0.0218 + 0.0083 Columns 50 through 56 0.0069 -0.0009 0.0039 Columns 57 through 63 0.0002 0.0010 0.0006 Columns 64 through 67 0.0001 0.0000 — - 0.0000 Example 24 Design a lowpass Butterworth filter to meet the fo IB passband gain = 0.89 WHO) A Passband frequency edge = 30 Hz attenuation = 0.20 stopband edge = 75 Hz 0.0001 0.0002 — 0.0069 - 0.0118 0.1269 — 0.0410 0.0090 0.0034 — 0.0002 0.0000 0.0001 — 0.0015 — 0.0062 0.0184 0.2826 0.0143 0.0126 0.0000 - 0.0004 — 0.0001 — 0.0022 0.0033 0.0374 0.3500 0.0374 0.0033 — 0.0022 - 0.0001 lowing specifications. — 0.004 0.0000 0.0126 0.0143 0.2826 0.0184 — 0.0062 — 0.0015 0.0001Solved Examples and MATLAB Solutions 11413 Soin ‘olution We have Q,,= 20x30= 188.40 rad/s (,=30Hz) Q,= 20x 15=471 rad/s (f,=75 Hz) 20 log 0.89= — 1 dB 2010g0.20— ForButerwort, 22/98020= -13:984B \HQ)y=— Ts@0y" For given specifications we have 089= - 1 7 ony Similarly 020= |] orindB, ~ 13.98=-10 og Hf } Q, 471 c 1+] —— (2!) These equations can be solved to find N and Q... ioe] log | N= ae 10°" =1 0.9834 471 lo; 47 ) 0.3979 7 188.4 irst calculate the order, N = 2.471 or N = 3 (we must choose the higher round off talue wen Now in order to find Q, substitute N = 3 in the equation containing stopband edge frequency , oy olay By" or — Q.=277.32 rad/s ato ations for butterworth filter are given by Poleloe $,= 0,077 RAMEN for(k=0,1,...N- 1) rculate poles for normalised transfer function i.e. Q. cal k= 0,12 N=3 we have , For 2 in 2 = k=0 sym cos = FJsm 3G k=l 5 = cos m+jsin t= —1 cos Mt jgin bj B fe2 $2= COS 7 Jin A 2 For N=3, total poles in S place are 2x N= 6, however we choose N poles that lie only on the ‘or N=, left hand S-plane.1414. solved Examples and MATLAB Solutions and Q, = | we have Thus for ~ (sth ts+l) _ However Q, = 277.32, we need to denormalised This transfer function is normalised for Q.= H(s) by Q,= 277.32 rad/s. H(s)|,0 5 = =—___2«_ (Now Substitute , = 277.32 rad/s) (542, (5 42,5427) Butterworth Polynomials Denominator of H(s) N (order) Denominator of H(S) 1 s+1 2. S?+1414S+1 3. (2 +S+1I) G+) 4. (S? + 0.7668 + 1) (S? + 1.8488 + 1) 5 (S? +0.618S + 1) (S? + 1.6188 + 1)(S +1) 6. (S? + 0.5188 + 1) (S? + 1.4148 + 1) (S? + 1.9328 + 1) 7. (S? + 0.4458 + 1) (S? + 1.2475 + 1)(S? + 1.8028 + 1)(S+ 1} MATLAB program Solution % Program to calculate the Order N and Wc of a low . Wp = 2*pi*30; Pass Butterworth filter > > > > ' >> RS = 13.985 fl (N,Wc] = buttord(Wp, Ws, Rp, Rs, 's') 23 We = 277.4569 Example 25 Design a digital lowpass Buttery, the following specifications, Passband ripple < 1.25 dB Passp,, Stopband attenuation 2 15 q al edge = 200 Hz Sampling frequency = 2 kHz Stopband edge = 300 Hz orth i f . filter using Bilinear Transformation Method to meetSolved Examples and MATLAB Solutions 1115 Solution Step I. Normalise angular bandedge frequencies with respect to sampling frequency. Thus o, = 2p _ 28X20 gag aa 2000 and o,= 28S, = 207300 _ 9 gy F, 2000 From specifications, — 1.25 dB < |H(@)| $0 dB 0<@<0.20 and |H(w)|<~15 4B 03S osm 2 Step II. Now prewarp frequencies corresponding to @, to @, using Q= = tan (2) Thus and (Note that Q and ware angular and digital frequencies respectively) Step III, Use required filter approximation formula to find Nand Q, corresponding to Q,, and Q,. In this case, for Butterworth approximation we have — TN (2) Q. Thus 2 7 (ey ‘| (for Q, = 0.649) an) ‘ (for Q.= 1.01) 9 0984 _ 5.125 or 6 HQ)= 20 log 1a “oe( 10) 0192 . te) (2) : ~15=~10log|1+| <2? ForN=6, eel a, yy Thus Q,= 0.75941116 Solved Examples and MATLAB Solutions For N= 6 we have 2x N= 12 poles in 360° i.e. with spacing of 30° or a 6 However, we only choose poles in Left Hand S-plane i.e. 6 poles. Since Nis even, poles will occur in conjugate pairs. x kN, JONG Thus for pole location we have S,=Q, e/"”? ¢ k =0,1,2,3,4,5 For prototype transfer function 2. = 1, we have in for k=0, so= el? 12 =-0.259 + j0.965 and S$, = -0.259-j0.965 combining these we gets” + 0.518 5+ I (approx). Similarly other poles will occur in conjugate pairs (5, and S,) and (S> and S;) and can be calculated for k= 1,4 and 2, 3. Step IV. Find the required transfer function. For convenience, Table | may be used for Butterworth polynomials that specifies denominator of H(s) for Q, . 1 5 -_—_ te Thus for N'=6 we have it) (s? +05185-+1)(s? +14145+ 1)(s? + 1.9325+1) However, we need to denormalise H(s) w.rt. 2, =0.7594 (cut-off frequency of required filtes) 6 (2.) (s7 +0.5182.5 +02)(? + 1.4140, 5 +02) +(s? +1.9320,5 + a?) eee ee __. (+ 0.3935 +0.577)(s? + 1.0735 +0.577)(s? +1478 + 0.577) Thus H(s)|,_ Step V. For Bilinear transformation substitute 2(z-1 s=of2c!)_,fz-1 = (4) 2) (for T= 1) Required transfer function H(z) is given below. 0.192 @ ‘Same methodology woul . 2 Would be used for Chebyshev approximation, however, order N, and Q- Id be different. . woul "nt. Once denormalised H (s) is obtained, replace Sby 2 ) to find H)- T OT ztlSolved Examples and MATLAB Solutions 1147 MATLAB program Solution >» ‘ Program to compute N and We of LP butterworth filter > N ae Dis Ws = 0.3*pis Rp = 1.25; Rs = 15s No. a i buttord(Wp, Ws, Rp, Rs, 's') We 0.7086537346682 oon a ng Program uses methodology of normalizing transfer function with i ge frequency rather than Wc, the cut off frequency) eee Compute frequency response of an IIR digital filter Wp = 200/1000; Ms = Rp =1.255 Rs = 15; IN, We] = buttord(hp, Ws, Rp, Rs); [z, p, k] = butter(n, 200/100) ; [b,a] = butter(N, 200/100) ; zplane(b,a) title('Pole zero plot of H(Z)') [H,f] = freqz(b, a, 256, Fs); plot(f, abs(H)) title('f-response of LP digital Butterworth filter with Wp=200 and Ws=300') frequency response of LP digital fiter ip = 100 and Ws = 150 300/1000; Y¥YYYYY Ye YY ¥ Pole zero pltotH@2) po 7 1 | 08 1 06 ] 1 oa} Imaginary Part 02 0 02 4 ; Magnitude 06 | 08 a 0 A jt ° = a 700 200 300 400 600 600 700 800 900 1000 7 Real Part = 05 frequency Example 26 Design 4 digital lowpass specifications. filter using Butterworth approximation to meet following of 512 Hz.4418 Solved Examples and MATLAB Solutions The prewarped frequencies corresponding to/,, = | 20 Hzand f,= 170 Hzare 2 Q,= 2 tan( Se bt Fi Solution 2 o, a,= 2 tan {2}. and 2 n(%) Forbilinear transformation s= 2(2—7]. T(t! Reader is advised to use 2, = tan { 2 | and Q, = tan (% | and s= { 2=+] because the oF 2 zl 2 - ‘. , 2 cancels out at numerator and denominator during course of calculations of order factor of filter and also H(2). Thus for F,= 512 Hz, 0,* 22x) =0.46875 A = 2 9 5st00n 312 6 Q,= tan (see) =0.9063 2 and Q,= tan (= B)a1ns8 Now for Butterworth characteristic we have oy ~16=~10log] 1+] “HF | > N=287=3 Thus, the normalized 3rd order filter is given by HM) = —~—_— O° Beery Now denormalising H1(s) by the required prewarped cut-off frequency Sp = 0.9063 we have a (ata) * —*_)ai (aa 0.9063 0.9063 0.9063 - 0.7444 (s? + 0.90635 + 0.8213) (s + 0.9063) z-1) , } +-as003( 25 z+ zt Als) = Now — H()=H(s) 0.7444 oot} +0506