Digital g Filter Structures • Isitpracticaltousetheconvolutional sumtoimplementLTIsystems? f y [n ] ¦ k f h [k ] x [n k ] • FIR:Yes. y [n ] ¦ f k f h [k ] x [n k ] • IIR:No itisnotpracticalbecausetheimpulseresponseisofinfinitelength. Butitcanbeimplementedbydirectcomputationofdifferenceequation y[n] ¦kN 1 d k y[n k ] ¦kM 0 pk x[n k ] • However,theabove However directimplementationmethodsmaynot provide satisfactoryperformanceduetothefiniteprecisionarithmeticofpractical processors • Itisthusofpracticalinteresttodevelopalternaterealizationsandchoosethe structure that provides satisfactory performance under finite precision structurethatprovidessatisfactoryperformanceunderfiniteprecision arithmetic Block Diagram g Representation p • FortheimplementationofanLTIdigitalfilter,theinputoutput relationshipmustbedescribedbyavalidcomputationalalgorithm • Toillustratewhatwemeanbyacomputationalalgorithm,considerthe causalfirstorderLTIdigitalfiltershownbelow • Thefilterisdescribedbythediff.eqn.: y[n] d1 y[n 1] p0 x[ n] p1x[n 1] • Usingtheaboveequationwecancomputey[n] if h i i i l iftheinitialcondition(y[1])isknown di i ( [ 1]) i k y[0] d1 y[1] p0 x[0] p1x[1] • y[1] d1 y[0] p0 x[1] p1x[0] y[2] d1 y[1] p0 x[2] p1x[1] .. . • Each step of the calculation requires a knowledge of the previously calculated value of the output sample (delayed value of the output), the present value of the input sample, and the previous value of the input sample (delayed value of the input) As a result, the firstorder difference equation q can be interpreted as a valid computational algorithm Basic Building Blocks • ThecomputationalalgorithmofanLTIdigitalfiltercanbe convenientlyrepresentedinblockdiagramformusingthebasic building blocks shown below buildingblocksshownbelow x[n] A y[n] x[n] [ ] w[n] Multiplier Adder z 1 x[n] y[n]] y[ x[n] x[n] y[n] Unit delay x[n] Pick-off node Advantagesofblockdiagramrepresentation g g p (1)Easytowritedownthecomputationalalgorithmbyinspection (2)Easytoanalyzetheblockdiagramtodeterminetheexplicitrelationbetweentheoutputandinput (3)Simplifiesderivingother“equivalent”blockdiagramsyieldingdifferentcomputationalalgorithms (4)Easytodeterminethehardwarerequirements (5)Easiertodevelopblockdiagramrepresentationsfromthetransferfunctiondirectly Analysis y of Block Diagrams g • Example Considerthesingleloopfeedbackstructureshownbelow • TheoutputE(z)oftheadderis E( z) X ( z ) G2 ( z )Y ( z ) • Butfromthefigure Y ( z ) G1 ( z ) E ( z ) • EliminatingE(z)fromtheprevioustwoequationswearriveat [1 G1 ( z )G2 ( z )]Y ( z ) G1 ( z ) X ( z ) H ( z) Y ( z) G1 ( z ) X ( z ) 1 G1 ( z )G2 ( z ) Th DelayThe Delay D l -F Free Loop L P Problem bl • For Forphysicalrealizability physical realizability ofthedigitalfilterstructure,itisnecessary of the digital filter structure it is necessary thattheblockdiagramrepresentationcontainsnodelayfreeloops • Toillustratethedelayfreeloopproblemconsiderthestructurebelow • Analysisofthisstructureyields u[n] w[n] y[n] y[ n] B (v[n] Au[n]) y[n] B v[n] A( w[n] y[n]) Todeterminethecurrentvalueofy[n] youneedtoknowthevalueofy[n]! Thisisphysicallyimpossible p y y p toachieve Canonic and Noncanonic Structures • Adigitalfilterstructureissaidtobecanonic ifthenumberofdelaysin the block diagram representation = theorder theblockdiagramrepresentation the order ofthetransferfunction of the transfer function • Otherwise,itisanoncanonic structure • Example y[ n] d1 y[n 1] p0 x[n] p1x[ n 1] No.ofDelaysintheblockdiagram=2 Orderofthetransferfunction=1 Î Noncanonic Equivalent Structures • • Twodigitalfilterstructuresaredefinedtobeequivalent iftheyhavethesametransfer function AsimplewaytogenerateequivalentstructuresisusingTransposeOperation p y g q g p p TransposeOperation (1)Reverseallpaths (2)Replacepickoffnodesbyadders,andviceversa (3)Interchangetheinputandoutputnodes Equivalent Structures TransposeOperation Transpose Operation (1)Reverseallpaths (2)Replacepickoffnodesbyadders,andviceversa (3)Interchangetheinputandoutputnodes Equivalent Structures • Question:Whystudydifferentstructures althoughtheyhavethesame transferfunction? • • Assuminginfiniteprecisionarithmetic,anygivenrealizationofadigital filterbehavesidenticallytoanyotherequivalentstructure. , p , g limitations,aspecific , p However,inpractice,duetothefinitewordlength realizationbehavestotallydifferentlyfromitsotherequivalentrealizations • Thereareliterallyaninfinitenumberofequivalentstructures realizingthesametransferfunction • Itisthusimpossibletodevelopallequivalentrealizations. • Onewaytofindagoodstructureistodeterminealargenumberof equivalent structures analyze the finite wordlength effectsineach equivalentstructures,analyzethefinitewordlength effects in each case,andselecttheoneshowingtheleast quantization effects • Inthiscoursewerestrictourattentiontoadiscussionofsome commonlyusedstructures. Basic FIR Digital Filter Structures • AcausalFIRfilteroforderN ischaracterizedbyatransferfunctionH(z) givenby b N n H ( z) ¦n 0 h[n]z • In Inthetime the timedomain domaintheinput the inputoutput outputrelationoftheaboveFIRfilteris relation of the above FIR filter is givenby N y[n] ¦k 0 h[k ]x[n k ] • AnFIRfilteroforderN ischaracterizedbyN+1coefficientsand,in g general,require q N+1 multipliersand N adders • Structuresinwhichthemultipliercoefficientsareequaltothe coefficientsofthetransferfunctionarecalleddirectform structures Direct Form FIR Digital Filter Structures • AdirectformrealizationofanFIRfiltercanbereadilydevelopedfrom theconvolutionsumdescriptionasindicatedbelowforN =4 • Ananalysisofthisstructureyields y [n ] h [0]x [n ] h [1]x [n 1] h [2]x [n 2] h [3]x [n 3] h [4]x [n 4] whichispreciselyoftheformoftheconvolutionsum description • Thedirectformstructureisalsoknownasatapped delayline ora transversalfilter Direct Form FIR Digital g Filter Structures • Thetranspose ofthedirectformstructure shownearlierisindicatedbelow • Both Bothdirectformstructuresarecanonic direct form structures are canonic withrespecttodelays Cascade Form FIR Digital Filter Structures • AhigherorderFIRtransferfunctioncan also be realized as a cascade of second alsoberealizedasacascadeofsecond orderFIRsectionsandpossiblyafirstorder section • WeexpressH(z)as H ( z ) h[0]kK 1(1 E1k z 1 E 2 k z 2 ) where K N if N iseven,andifNis whereifN is even and K N21 if N is 2 odd,with E 2 K 0 Cascade Form FIR Digital Filter Structures • AcascaderealizationforN =6isshownbelow • Eachsecondordersectionintheabovestructure canalsoberealizedinthetransposeddirectform Polyphase FIR Structures • Example:consideracausalFIRtransferfunctionH(z)withN =8: H (z ) h [0] h [1]z 1 h [2]z 2 h [3]z 3 h [4]z 4 h [5]z 5 h [6]z 6 h [7]z 7 h [8]z 8 • H(z)canbeexpressedasasumoftwoterms,withonetermcontainingthe evenindexedcoefficientsandtheothercontainingtheoddindexedcoeff.: H (z ) (h [0] h [2]z 2 h [4]z 4 h [6]z 6 h [8]z 8 ) (h [1]z 1 h [3]z 3 h [5]z 5 h [7]z 7 ) H (z ) (h [0] h [2]z 2 h [4]z 4 h [6]z 6 h [8]z 8 ) z 1 (h [1] h [3]z 2 h [5]z 4 h [7]z 6 ) H ( z) E0 ( z 2 ) z 1E1( z 2 ) Polyphase Decomposition Polyphase FIR Structures • Inasimilarmanner,bygroupingthetermsintheoriginalexpression forH(z),wecanreexpressitintheform H ( z ) E0 ( z 3 ) z 1E1( z 3 ) z 2 E2 ( z 3 ) E0 ( z ) h[0] h[3]z 1 h[6]z 2 E1( z ) h[1] h[4]z 1 h[7]z 2 E2 ( z ) h[2] h[5]z 1 h[8]z 2 • The Thesubfilters subfilters (theE (the E filters) inthepolyphase in the polyphase realizationofanFIR realization of an FIR transferfunctionarealsoFIRfiltersandcanberealizedusingany methodsdescribedsofar • Theabovepolyphase realizationsarenoncanonic.Toobtaina canonicrealizationoftheoverallstructure,thedelaysinallsubfilters mustbeshared Linear--Phase FIR Structures Linear • Thesymmetry(orantisymmetry)propertyofalinearphaseFIRfiltercan beexploitedtoreducethenumberofmultipliersintoalmosthalfofthat inthedirectformimplementations • Consideralength7TypeI FIRtransferfunctionwithasymmetricimpulse response: H ( z ) h[0] h[1]z 1 h[2]z 2 h[3]z 3 h[2]z 4 h[1]z 5 h[0]z 6 • RewritingH(z)intheform H ( z ) h[0](1 z 6 ) h[1]( z 1 z 5 ) h[2]( z 2 z 4 ) h[3]z 3 weobtainthelinearphaserealization • Inthisexample: 4 • No.ofMultipliersofLinearPhaserealization= N f M lti li f Li Ph li ti • No.ofMultipliersofDirectFormrealization= 7 Linear--Phase FIR Structures Linear • A similar decomposition can be applied to a Type 2 FIR transfer function • For example, example a length length-8 8 Type 2 FIR transfer function can be expressed as H ( z ) h[0](1 z 7 ) h[1]( z 1 z 6 ) h[2]( z 2 z 5 ) h[3]( z 3 z 4 ) • The corresponding realization is shown on th nextt slide the lid Copyright © 2001, S. K. Mitra Linear--Phase FIR Structures Linear • Note: The Type 1 linear-phase structure for a length-7 length 7 FIR filter requires 4 multipliers, multipliers whereas a direct form realization requires 7 multipliers lti li Copyright © 2001, S. K. Mitra Basic IIR Digital Filter Structures • • • • • ThecausalIIRdigitalfiltersweareconcernedwithinthiscourseare characterizedbyarealrationaltransferfunctionofz1 or,equivalentlybya constant coefficient difference equation constantcoefficientdifferenceequation Fromthedifferenceequationrepresentation,itcanbeseenthatthe realizationofthecausalIIR digitalfiltersrequiressomeformoffeedback An Nth AnN th orderIIRdigitaltransferfunctionischaracterizedby2N+1unique order IIR digital transfer function is characterized by 2N+1 unique coefficients,andingeneral,requires2N+1multipliersand2N twoinputadders forimplementation Direct form IIR filters: Filter structures in which the multiplier coefficients are DirectformIIRfilters:Filterstructuresinwhichthemultipliercoefficientsare equaltothecoefficientsofthetransferfunction Example:Considerforsimplicitya3rdorderIIRfilterwithatransferfunction. p p y (seenextslide) H ( z) P( z ) D( z ) p0 p1z 1 p2 z 2 p3 z 3 1 d1z 1 d 2 z 2 d3 z 3 Direct Form IIR Digital Filter Structures H ( z) P( z ) D( z ) p0 p1z 1 p2 z 2 p3 z 3 1 d1z 1 d 2 z 2 d3 z 3 Direct Form I Note:ThedirectformIstructureis noncanonic i asitemploys6delaysto it l 6d l t realizea3rdordertransferfunction Transposed Direct Form I Direct Form IIR Digital Filter Structures • Variousothernoncanonic directformstructurescanbederivedby simpleblockdiagrammanipulationsasshownbelow Sharingofalldelays reduces the total number reducesthetotalnumber ofdelaysto3resultingina canonicrealization Direct Form IIR Digital Filter Structures DirectFormII TransposedDirectFormII Cascade Form IIR Digital Filter Structures • Byexpressingthenumeratorandthedenominatorpolynomialsofthe transferfunctionasaproductofpolynomialsoflowerdegree,a digital filter can be realized as a cascade of loworder digitalfiltercanberealizedasacascadeoflow orderfiltersections filter sections • Consider,forexample,H(z)=P(z)/D(z)expressedas H (z ) P (z ) D (z ) P1 (z )P2 (z )P3 (z ) D1 ( z ) D 2 ( z ) D 3 ( z ) • Examplesofcascaderealizationsobtainedbydifferentpolezero pairingsordifferentorderingofsectionsareshownbelow • Thereare36differentstructures.Duetofinitewordlength effects, each such cascade realization behaves differently from others eachsuchcascaderealizationbehavesdifferentlyfromothers Cascade Form IIR Digital Filter Structures • Usually,thepolynomialsarefactoredintoaproductof1st order and 2nd order polynomials: § 1 E1k z 1 E 2 k z 2 · ¸ H ( z ) p0 ¨¨ 1 2 ¸ 1 D D z z k © ¹ 1k 2k Intheabove,forafirstorderfactor D 2 k E 2 k 0 • Question:Whyprefer1st orderand2nd ordersections? • It’seasiertocheckandensurestability 1st Order 2nd Order Sectiontransferfunc. " 1 cz 1 " 1 az 1 bz 2 Tobestableandcausal c 1 a 2 AND a 1 b Cascade Form IIR Digital Filter Structures • Example Considerthe3rdordertransferfunction H ( z) 1 E11z 1 ·§ 1 E12 z 1 E 22 z 2 · § p0 ¨ ¨ ¸ 1 ¸¨ 1 2 ¸ D z 1 1 D z D z © 11 ¹© ¹ 12 22 • Onepossiblerealizationisshownbelow Cascade Form IIR Digital Filter Structures • Example DirectformIIandcascadeformrealizationsof 0.44 z 1 0.362 z 2 0.02 z 3 H ( z) 1 0.4 z 1 0.18 z 2 0.2 z 3 § 0.44 0.362 z 1 0.02 z 2 ·§ z 1 · ¨ ¸¨ 1 2 1 ¸ © 1 0.8 z 0.5 z ¹© 10.4 z ¹ DirectformII Cascadeformofa1 Cascade formofa1st orderand2nd ordersections Parallel Form IIR Digital Filter Structures • Apartialfractionexpansionofthetransferfunctioninz1 leadstothe parallelform structure • Assumingsimplepoles,thetransferfunctionH(z)canbeexpressedas J 0 k J 1k z 1 · § H ( z) J 0 ¦ ¨ 1 2 ¸ z z 1 D D ¹ © k k 1 2 k • Intheaboveforarealpole D 2k J 1k 0 P ll l f Parallelform Parallel Form IIR Digital Filter Structures • Example – FindaparallelformIrealization: H ( z) 0.44 z 1 0.362 z 2 0.02 z 3 1 0.4 z 1 0.18 z 2 0.2 z 3 H ( z ) 0.1 0.6 1 0.4 z 1 0.5 0.2 z 1 1 0.8 z 1 0.5 z 2 Using MATLAB - FIR • Note: An FIR transfer function can be treated as an IIR transfer function with a constant numerator of unityy and a denominator which is the polynomial describing the FIR transfer function Copyright © 2001, S. K. Mitra Using MATLAB – Cascade Form • The cascade form requires the factorization of the transfer function which can be developed using the M-file zp2sos • The Th statement sos = zp2sos(z,p,k) ( ) generates a matrix i sos containing the coefficients of each 2nd-order section of the equivalent transfer function H(z) determined from its pole-zero form • sos is an Lx6 matrix of the form sos ª p 01 « p 02 « «p ¬ 0L p 11 p 12 p 21 p 22 d 01 d 02 d 11 d 12 d d 21 p 1L p 2L d 0L d 1L d 2L 22 º » » » ¼ • L denotes the number of sections given byy • The form of the overall transfer function is g p0i p1i z 1 p2i z 2 H ( z) Hi ( z) 1 2 i 1 i 1 d 0i d1i z d 2i z L L Using MATLAB – Parallel Form • Parallel forms can be developed using the functions residuez to obtain the partial fraction expansion