Phil Lucht Math & Physics Archive
Home / Math and Physics Files / Math / Spectral Theory Book / PDF downloads

filter design

PDF · 11 pages · 90.4 KB
Open PDF file

Lecture notes (Lecture 6, pages numbered 71-81) on designing digital filters, apparently a downloaded course handout filed among Phil's spectral theory book materials. Topics are moving-average and Hanning filters, FIR design from a brick-wall response with truncation, Gibbs overshoot and Hamming/Hanning windows, and IIR design via the bilinear transform with frequency pre-warping. It ends with a worked second-order Butterworth low-pass example (2 kHz cut-off, 10 kHz sampling). Equations are garbled in the extracted text.

AI-written summary; may contain errors. This description is approximate.

Extracted text (machine-read; may contain errors)
Lecture6-DesignofDigitalFilters 6.1Simplefilters Therearetwomethodsforsmoothing asequence ofnumbersinordertoapprox- imatealow-passfilter:thepolynomial fit,asjustdescribed, andthemovingav- erage.Inthefirstcase,theapproximation toaLPFcanbeimprovedbyusing ahigher-degreepolynomial: forexample,insteadofusingaquadratic asinthe examplegiveninthepreviouslecture,wecouldhavefittedaleast-squares quartic totheoriginal“noisy”data.Theeffectofusingahigher-degreepolynomial is togivebothahigherdegreeoftangencyat andasharpercut-offinthe amplitude response. Anexampleofasimplemoving-averagefilteristheHanningfilter,forwhich:           Thisfilterproduces anoutputwhichisascaledaverageofthreesuccessiveinputs, withthecentrepointofthethreeweighted twiceasheavilyasitstwoadjacent neighbours. 6.1.1Designbyz-domain arguments Takingthez-transfom weobtainatransferfunctionoftheform "!   #!$&% !$'  whichhastwozeroesat!' (!  "!  ' i.e.! ) .Remember thatthiscorresponds toadoubledampingattheNyquistfrequency.Thiswillgive attenuation ofHFsignalsi.e.aLPFeffect.Alternativelywecouldarguetoputa 71 poleatDC,somefraction *,+* ofthewayalongtherealaxis.Thisgives -!  ! .+  !$&% .+!$&% andthus/-!  .+!$&% ! $&%102"!  andindifferencetermsinthedigitaltimedomain  3  +456 whichgivesaLPFasarecurrentfilter(whichisthusanIIRfilter).Ingeneral,we mayuseoutknowledgeoftheLaplacedesignoftransferfunctions toarguethe designinthez-domain aswell.Thisissimpleforlow-orderfilters(asabove),but wouldbetediousathigherorders–thereareotherways. 6.2FIRdesignsbasedonwindowfunctions FIRfilterscanalsobedesigned fromafrequencyresponse specification. The equivalentsampledimpulseresponse, whichdetermines thecoefficientsofthe FIRfilter,canthenbefoundbyinverse(discrete) Fouriertransformation (Discrete FourierTransforms arenotcovereduntillaterinthecoursebuttheexamplefilter designbelowshouldstillbeeasytofollow). Consider anideallow-passcharacteristic (brick-wallfilter) 798 :withacut- offfrequency <;=(>4? A@where @sampling period: Weknowthatthecontinuous impulseresponse CB isgivenby(andshownin Fig.6.1):DB E > F,G$ G 7H8 :JILK1MNCOA <;>QPSRUT9V =;B<;BXW(6.1) Thesampledimpulseresponse D (whichwouldbeobtainedbytakingthein- verseDFTofthediscreteequivalent“brick-wall”frequencycharacteristics) isthe sampledversionofthecontinuousY9Z\[ ]]function. Itisnotpossibletoimplement thecorresponding low-passfilterdesignbecause: 72 −10 −5 0 5 10−0.1−0.0500.050.10.150.20.25 tg(t) −10 −5 0 5 10−0.1−0.0500.050.10.150.20.25 kT (T=1)g[k] Figure6.1:Impulseresponseofbrickwallfilterin(left)continuous and(right) discretetimedomains.^aninfinitenumberofcoefficientswouldberequired^theimpulseresponse isthatofanon-causal system D existsbetween_a`and bc. Afirstsolution hencewecould, 1.Truncatetheexpression for D  atsomereasonable valueof ,say10. 2.Shiftallthecoefficientsbythesamenumber. ThisisshowninFig6.2. Nowthatwehavethedifferenceequation 3 'ed f gihdkj g lm" forthefilter,wecanalsoobtainitstransferfunction7"! k 'ed f gnhd j g! $ g Asbefore,wecanobtaintheactualfrequencyresponse ofthefilterbyevalu- ating 7-! ontheunitcircle(i.e. 7 IK1Mpo ).ThisisshowninFig6.3usingboth linearandlogarithmic plotsfortheamplitude response. 73 0 5 10 15 20−0.1−0.0500.050.10.150.20.25 kshift g[k] Figure6.2:Impulseresponseofbrickwallfiltershifted. 0 20 40 60 80 100 120 14000.20.40.60.811.21.4 π/4 0 20 40 60 80 100 120 14010−310−210−1100101 π/4 Figure6.3:Linear(left)andlog(right)responses for21and11coefficientsinthe brickwallfilter. Bettersolution Thetruncation oftheimpulseresponseisequivalenttomultiplying itbyarectan- gular“window”function. Thisleadstoanovershootandripplebeforeandafter thediscontinuity inthefrequencyresponse –aphenomenom knownasGibb’s phenomenom (theovershootisabout9%–seepreviousFig).Theamplitude of theovershootdoesnotdecreaseifmoreandmorecoefficientsareincludedinthe digitalfilter. Amoresuccessful wayofdesigning anFIRfilteristouseafiniteweighting sequence q  .Thereareanumberofsuchsequences, forexampletheHamming, 74 HanningorKaiserwindows.q  sr +t .+SvuxwRSyUz { .|E}(~}| 0elsewhere If +€(vƒ‚ thisistheHamming window,if +€(vƒ‚thisistheHanning,orraised cosine,window.Fig6.4showsthe11pointHamming window.TheFourier 02468101200.20.40.60.81 kw[k] Figure6.4:11pointHamming window. transform ofthesewindowsconsistsofacentrallobewhichcontainsmostofthe energyandsidelobeswhichgenerally decayveryrapidly. TheuseofsuchawindowtoreducetheFouriercoefficientsforthehigherfre- quencytermsleadstoareduction inrippleamplitude, attheexpenseofaslightly worseinitialcut-offslope.Thefrequencyresponseofthe21-coefficientFIRfilter Fig.6.3isshowninFig.6.5togetherwiththatoftheequivalent“windowed” filter(thefilterweightsonthiscasebeingcomputed from D5 3D5 "q   )using aHamming window. 6.2.1FIRfilterdesign–conclusion FIRfiltersareusuallyfoundinapplications wherewaveformdistortion dueto non-linear phaseisharmful. Asthe2examplesoffiltersstudiedillustrate, FIR filterswithexactlylinearphasecanbedesigned (theymusthaveanimpulsere- sponsewhichiseithersymmetrical –i.e.palindromic coefficients–orpurely 75 0 20 40 60 80 100 120 14000.20.40.60.811.21.4 π/4 Figure6.5:Hamming windowremovingovershoot. anti-symmetrical). FIRfiltersaremostlyrealisedasnon-recursi vestructures; such filtersarealwaysstable.However,ifasharpcut-offintheamplitude response is required, alargenumberofcoefficientsareneeded(usually „100). 76 6.3DesignofIIRfilters Mostrecursivefiltershaveaninfiniteimpulseresponse, becauseofthefeedback ofpreviousoutputs.Practical Infinite-Impulse-Response (IIR)filtersareusually baseduponanalogue equivalents(Butterworth,Chebyshe v,etc.),usingatransfor- mationknownasthebilineartransformation whichmapsthe…-planepolesand zerosoftheanalogue filterintothe!-plane.However,itisquitepossibletodesign anIIRfilterwithoutanyreference toanalogue designs,forexamplebychoos- ingappropriate locations forthepolesandzeroesontheunitcircle(Remember:7 IKeMo k†whereverthereisazeroontheunitcircle,i.e.complete attenuation ofthatfrequency;ontheotherhand, 7 IK1Mpo ‡ `whenthereisapolenearthe unitcircle,i.e.highgainatthatfrequency). 6.4Bilineartransformation Thetechnique ofdigitizing ananalogue designisthemostpopularIIRfilterdesign technique, sincethereisalargeamountoftheoryonstandard analogue filters available(someofwhichwasexploredinthefirsthalfofthislecturecourse). Thebilinear!-transform isamathematical transformation fromthe…-domain tothe!-domainwhichpreservesthefrequencycharacteristics andisdefinedby:…  @ !$&% !$&%where @sampling period Underthismapping, theentire8 axisinthe …-planeismappedontotheunit circleinthe!-plane;theleft-half …-planeismappedinsidetheunitcircleandthe right-half …-planeismappedoutsidetheunitcircle. Thebilineartransformation givesanon-linear relationship betweenanalogue frequency <ˆanddigitalfrequency <‰.Sincethefrequencyresponse ofadigital filterisevaluatedbysetting! bIK1Mpo:… ˆŠ8 =ˆ‹ @ .I$ K1MŒeo 2I$ K1MŒ o  @ I K1MŒ o' .I$ K1MŒ o'I K1MŒ o' 2I$ K1MŒ o'  @ސV’‘ 8 <‰ @ ie. <ˆŠ @ސV <‰ @ 77 Theformofthisnon-linearity isshowninFig.6.6forthecase @“.For smallvaluesof <‰,themappingisalmostlinear;formostofthefrequencyscale, however,themappingishighlynon-linear . 0 0.5 1 1.500.511.522.533.5 ωdωa Figure6.6:Thebilinearmappingfunction. Thecut-offfrequencies ofadigitalfilterwilltherefore betangentially warped compared withthoseoftheanalogue filterfromwhichitwasdesigned. Inorder tocompensate forthisundesirable effect,itisnecessary topre-warptherequired cut-offfrequencies beforedesigning theanalogue filter.Thus^thedesiredsetofdigitalfiltercut-offfrequencies isdetermined first.For example,iftherearefourcritcialcut-offfrequencies, =‰%•” <‰'–” <‰1—and =‰e˜). Usingthefrequencywarpingrelationship derivedabove,thefiltercut-off frequencies areconvertedtoanewsetofanalogue cut-offfrequencies,<ˆ%™” <ˆ'” <ˆJ—and =ˆ1˜.^Finally,ananalogue filterisdesigned withtheappropriate warpedcut-off frequencies. Applying thebilineartransformation tothisanalogue filter givesadigitalfilterwiththedesiredcut-offfrequencies. 78 6.4.1Example: designofIIRfilterusingbilinearz-transform Designadigitallow-passButterworthfilterwitha3dBcut-offfrequencyof2kHz andminimum attenuation of30dBat4.25kHzforasampling rateof10kHz. Answerš›  ˜ Hz;hence @ $ ˜ sec.<‰% œ>žŸ  — rads/sec; =‰'  >€ ¡¢‚  — rads/sec. Applypre-warping transformation:<ˆ%  @#ŽLV =‰% @ b  ˜ŽLV vƒp>£œvƒ¤AA¥c‚  @  ¡‚A¦  — rads/sec<ˆ'  @ ŽLV <‰' @ b  ˜ŽLV v ¢‚>§(¨¢¦v ¦   — rads/sec (ie. šˆ%   ¦kHzand šˆ'  ¦v ¦kHz–thisshowsthewarpingeffectnear ©"ª') Theorderoffilterrequiredcannowbeworkedoutasbefore:«­¬ ®C¯ D°®-¯ DM±M–² ³®C¯ D%-d ´ ®C¯ D%-dcµ —U¶ —%% ˜¶ ·e—  ¡¸A¨¹»º½¼meetsthespecification Forasecond-order ButterworthLPF,7 … k ' ;…' … ´p<; ' ; Substitute <ˆ% b<;k¾ƒ¤¢¿¥c‚ 'oinaboveequationandusethebilineartransfor- mation … 'o %e$ÀÁ¿Â%"ÒÀÁ¿Â:7"! k 'o ' ƒ¤¢¿¥c‚ ''o ' %e$ÀÁ¿Â%"ÒÀÁ¿Â '  ´'o ' v¡¤¢A¥c‚ %e$ÀÁAÂ%"ÒÀÁA Ä'o '  v¡¤¢A¥¢‚ ' 79 (NB:'o factorcancelsout)7-!  v¡‚¢¢¤A¨A¥%e$ÀÁAÂ%"ÒÀÁA '   c¢¤ ¸%e$ÀÁAÂ%"ÒÀÁ¿Â Äv¡‚¢¢¤¿¨¢¥7-! kœv¡‚¢¢¤A¨A¥ #!$&% !$'¡‚¢‚¢‚A¦c‚Åv ¸ ¢¢¤!$&% v¡‚A¢¢¦A¨!$'7-! bv¡A¢¥c‚¢¤ #!$&% !$' .v ¦¢¥¢¸c‚A¦!$&% v ¸c‚A¨¢!$' fromwhichwecanfinallywritethefollowingdifferenceequation:  <Ævƒ¿¢¥c‚¢¤  vÇv  ¦    ’,v¡A¢¥c‚A¤  Ç vÇv ¦¢¥¢¸c‚¿¦A5l 3v ¸c‚¿¨c¿ È2p Inordertocheckthemagnitude characteristics ofthefrequencyresponse, re- write 7"! as:7-! bv¡A¢¥c‚A¤ !' #!  !' v ¦¢¥¢¸c‚¿¦! v ¸c‚A¨¢^dcgain: <‰ @œȇ!  whichgives É\7 É  ^3dBcut-offfrequency <‰% @(v > Thus7 Id ¶ ˜z K•kœvƒ¿¢¥c‚¢¤ uxwR v ¨¿>Ê8RUT9V ¡¨¿>Ê uxwR v >Ê8RUTËV  >ÌÄ uxwR ¡¨¿>Ê8RUT9V v ¨¿>Ív ¦¢¥¢¸c‚A¦ uÎwR v >Ê8RJTËV v >4Ä2v ¸c‚A¨c ie. 7 Id ¶ ˜z K•k(v¡A¢¥c‚¢¤ v ¨¢¢¸¢‹# ¨¢¸¢¸8av¡¤¢¢¤¿¦¢¸‹ƒA¦A¥¢¦ 8whichgives É\7~É œv¡¤Ac¤ 80 Youcanalsocheckthe30dBminimum attenuation requirement byworkingout7 Id ¶µ ·z K . 6.4.2Conclusion WithrecursiveIIRfilters,wecangenerally achieveadesiredfrequencyresponse characteristic withafilteroflowerorderthanforanon-recursi vefilter(especially ifellipticdesignsareused).Arecursivefilterhasbothpolesandzeroeswhich canbeselectedbythedesigner,hencetherearemorefreeparameters thanfora non-recursi vefilterofthesameorder(onlyzeroescanbevaried).However,when thepolesofanIIRfilterareclosetotheunitcircle,theyneedtobespecified very accurately (typically 3to6decimalplaces)ifinstability istobeavoided. 81