EE 313 Linear Signals & Systems (Fall...
Transcript of EE 313 Linear Signals & Systems (Fall...
EE313LinearSignals&Systems(Fall2018)
SolutionSetforHomework#7onInfiniteImpulseResponse(IIR)FiltersCORRECTED
By:Mr.HoushangSalimianandProf.BrianL.Evans
PrologfortheSolutionSet.Bothdiscrete-timefiniteimpulseresponse(FIR)filtersanddiscrete-timeinfiniteimpulseresponse(IIR)filtersarewidelyusedinpractice.Theyarebothusedinspeechandaudio processing. Speech compression/decompression algorithms on smart phones use IIR filters.Splitting theaudible range intosub-woolfer (20-200Hz),wolfer (200-2000Hz)and tweeter (2000-20000Hz)bandsinaudiospeakersisimplementedusingIIRfilters.FIRfiltersaremorecommonthanIIRfiltersinimageandvideoprocessing;however,IIRfiltersareusedinimagedisplayandprinting.Analog-to-digital converters use IIR filters, and digital-to-analog converters use both FIR and IIRfilters.BothFIRandIIRfiltersareusedincommunicationsystems.
As the passband becomesmore andmore narrow, the number of FIR coefficients increases at amuchfasterpacevs.thenumberofIIRcoefficients. Forexample, forabandpassfilterthatpasseswolferfrequenciesof200Hzto2000Hzinadiscrete-timeaudiosignalsampledat48000Hzwouldrequire an FIR filter with 4352 coefficients or an IIR filter with 33 coefficients (obtained from 16poles,16zeros,and1gain).Eachcoefficientrepresentsamultiplicationwhencomputinganoutputsample;hence,thewolferFIRfilterrequires100timesmoremultiplicationsthanthewolferIIRfilter.
Whenwehadanalyzedthefrequencyresponseoftheaveragingfilteronhomework#6,tuneup#6,andtuneup#7,wehadseenthatphaseresponseislinearvs.frequency.Lectureslide9-9derivesthemagnitude and phase response for the two-point averaging filter. A linear phase responsecorresponds to a fixed delay (called the group delay) through the filter. See lecture slide 9-8.Althoughwedidn’thavethechancetogooverlectureslides9-8and9-9,wedidseealinearphaseresponsefora3-pointlowpassfilteronlectureslide9-6.Also,thebandpassFIRfilterbasedontheHammingwindowinmini-project#2hadlinearphase(constantgroupdelay).
FIRfilterscanbedesignedtohavelinearphaseoverallfrequencies.AlthoughthisisnotpossibleforIIR filters, IIR filters can be designed to have approximate linear phase over the passband.Audio,imaging,andcertaincommunicationsystemsareverysensitivetophasedistortion.
IIR filters have one significant drawback— when implemented, they can become bounded-inputbounded-output(BIBO)unstableeventhoughtheirdesignisBIBOstable.FIRfiltersarealwaysBIBOstable.Pleaseseelectureslides11-12and11-13andHandoutHonBIBOStability.
Problem1
Prolog: Thisproblemasks you toanalyze seven linear time-invariant (LTI) filters in the frequencyandzdomains,andmatchtheirmagnituderesponsetooneofsixexampleresponses.Thisproblemisintendedtohelpyoumakeconnectionsbetweenthetime,frequencyandzdomains.Inparticular,theproblemisintendedtobuildexperienceontheimpactofpolesandzerosinthetransferfunctioninthez-domainonthemagnituderesponseofafilter.EachLTIfilterisobservedforn≥0.AlloftheinitialconditionsarezeroasanecessaryconditionforLTItohold.
MATLABcodeisgivenattheendoftheproblemsolution.
Fall2018EE313Homework7solution|TheUniversityofTexasatAustin
Concerningtheconnectionsbetweenthetime, frequencyandzdomains fordiscrete-timefilters, Irecorded a YouTube video in spring 2014 for the EE 445S Real-TimeDigital Signal Processing Labcourse.Pleasewatchfromthe1:29marktothe22:25markandfrom43:01totheend(50:51)at
https://www.youtube.com/watch?v=WWEKNvvJBvs&list=PLaJppqXMef2ZHIKM4vpwHIAWyRmw3TtSf
Polesorzerosattheorigininthez-domainhavenoimpactonthemagnituderesponsebetweenthedistancefromanypointontheunitcircle𝑧 = 𝑒!!totheoriginis1forallvaluesofthediscrete-timefrequency𝜔.Whenagroupofpolesisseparateinanglefromagroupofzeros,theanglesofpolesneartheunitcircleindicateapassbandofthefilterandtheanglesofzerosonorneartheunitcircleindicateastopbandofthefilter.ThisisthecaseforallofthefiltersbelowexceptfilterS2.FilterS2hasonepoleandonezeroatthesameangle.Theirradiiareinverselyrelated,andthisgivesanall-passfilter.PleaseseeHandoutIonAll-PassFiltersat
http://users.ece.utexas.edu/~bevans/courses/signals/handouts/Appendix%20I%20All%20Pass%20Filters.pdf
Solutions
FilterS1isgivenasadifferenceequation.ThisproblemwasthesubjectofTune-UpTuesday#9.
1 1 1 1[ ] 0.9 [ 1] [ ] [ 1] [ ] 0.9 [ 1] [ ] [ 1]2 2 2 2
y n y n x n x n y n y n x n x n= − + + − ⇒ − − = + −
( )1 1 1 11 1 1 1( ) 0.9 ( ) ( ) ( ) ( ) 1 0.9 ( )2 2 2 2
Y z z Y z X z z X z Y z z X z z− − − −⎛ ⎞− = + → − = +⎜ ⎟⎝ ⎠
H (z) = Y (z)X (z)
=
121+ z−1( )
1−0.9z1=
12z +1( )
z −0.9=12
z +1z −0.9⎛
⎝⎜
⎞
⎠⎟
Tocalculatezerosandpoles,wecalculaterootsofnumeratoranddenominator,respectively.
Zeros: 1 0 1z z+ = ⇒ = − .Zeroontheunitcircleatangleπ indicatesthatfrequenciesat–πandπ rad/samplearezeroedoutandareinthestopband.
Poles: 0.9 0 0.9z z− = ⇒ = Apoleneartheunitcircleindicatesthatapeakinthemagnituderesponseoccursatthepoleangle,whichis0rad/sample.Thepassbandiscenteredat0rad/sample.
Fall2018EE313Homework7solution|TheUniversityofTexasatAustin
FrequencyresponsematchesfigureA.Frequencyresponseshowsthatthefrequenciesaroundzeroarepassedandthemagnitudedecreasesforhigherfrequencies,hence,S1isalow-passfilter.
FilterS2isalsogivenasadifferenceequation.
[ ] 0.9 [ 1] 9 [ ] 10 [ 1] [ ] 0.9 [ 1] 9 [ ] 10 [ 1]y n y n x n x n y n y n x n x n= − − + + − ⇒ + − = + −
( ) ( )1 1 1 1( ) 0.9 ( ) 9 ( ) 10 ( ) ( ) 1 0.9 ( ) 9 10Y z z Y z X z z X z Y z z X z z− − − −+ = + → + = +
1
1
( ) 9 10 9 10( )( ) 1 0.9 0.9
Y z z zH zX z z z
−+ += = =
+ +
Zero:9 10 0 10 / 9 1.111z z+ = ⇒ = − = − .Radiusistheinverseoftheradiousofthepole.
Pole: 0.9 0 0.9z z+ = ⇒ = − .Poleandzeroareatthesameanglewillinteract.Seetheprolog.
ThefrequencyresponsematchesfigureD.Thisfilterpassesallfrequencieswiththesamemagnitude,i.e.magnitude=10,soS2isanall-passfilter.
FilterS3isgivenbyitstransferfunctioninthezdomain:
( ) ( )1
1
1 11 12 2( )1 0.9 0.9
z zH z
z z
−
−
− −= =
+ +
Fall2018EE313Homework7solution|TheUniversityofTexasatAustin
Zero: 1 0 1z z− = ⇒ = .Zeroontheunitcircleatangle0 indicatesthatfrequencyat0rad/sampleiszeroedoutandisinthestopband.Infact,thestopbandiscenteredat0rad/sample.
Pole: 0.9 0 0.9z z+ = ⇒ = − .Apoleneartheunitcircleindicatesthatapeakinthemagnitude
responseoccursatthepoleangle,whichisπrad/sample.Thepassbandiscenteredatπrad/sample
ThisplotmatchesfigureB,whichisahighpassfilter.
FilterS4isgivenasadifferenceequation:
1 3 1[ ] [ ] [ 1] [ 2] [ 3] [ 4]4 2 4
y n x n x n x n x n x n= + − + − + − + −
1 2 3 41 3 1( ) ( ) ( ) ( ) ( ) ( )4 2 4
Y z X z z X z z X z z X z z X z− − − −= + + + +
4 3 2
1 2 3 44
1 3 1( ) 1 3 1 4 2 4( )( ) 4 2 4
z z z zY zH z z z z zX z z
− − − −+ + + +
= = + + + + =
Wecancalculatetherootsofthenumeratorbyusingroots()inMATLAB.
p=[1/413/211/4];roots(p)
MATLABfindfouruniquerootscloseto-1:
Zeros: 4 3 21 2,3 4
1 3 1 0 1.0002, 1 0.0002, 0.99984 2 4z z z z z z j z+ + + + = ⇒ = − = − ± = −
Thecorrectanswerisarepeatedrootatz=-1,whichiscorrectlyindicatedinthepole-zeroplot.
Havingfourrepeatedzerosatangleofπmeansthatthereductioninmagnitudeatfrequenciesnearπ rad/sampleareraisedtothefourthpower.Thesmallmagnitudevaluesbecomemuchsmaller.
Poles: 4 0 0z z= ⇒ = Fourpolesatz=0.Polesattheorigininthezdomainhavenoeffectonthemagnituderesponse.
FrequencyresponseissimilartoFigureF,whichisalowpassfilter.
Fall2018EE313Homework7solution|TheUniversityofTexasatAustin
FilterS5isgivenasatransferfunctioninthezdomain:
4 3 2 11 2 3 4
4
1( ) 1 z z z zH z z z z zz
− − − − − + − += − + − + =
Zeros: 4 3 2 11,2 3,41 0 0.3090 0.9511, 0.8090 0.5878z z z z z j z j− + − + = ⇒ = − ± = ±
Poles:Fourpolesatz=0.
ThisplotisshowninFigureE.Accordingtothefrequencyresponse,wehaveahighpassfilter,becauseithashighgainathigherfrequenciesandlowgainatlowerfrequencies.ForS3,wehadanotherhighpassfilter,therethemagnitudeinstopbandwasverylowwhileforS5wecanseethatevenat0,considerablemagnitudecanbedetected.
FilterS6isgivenasadifferenceequation:
3 3 3
0 0 0[ ] [ ] ( ) ( ) ( )k k
k k ky n x n k Y z X z z X z z− −
= = =
= − ⇒ = =∑ ∑ ∑
3 231 2 3
30
( ) 1( ) 1( )
k
k
Y z z z zH z z z z zX z z
− − − −
=
+ + += = = + + + =∑
Zeros: 3 21 2,31 0 1,z z z z z j+ + + = ⇒ = − = ±
Poles: 3 0 0z z= ⇒ = Threepolesatz=0.
Fall2018EE313Homework7solution|TheUniversityofTexasatAustin
ThefrequencyresponseislikefigureC,anditrepresentsalowpassfilter.
FilterS7isgivenasadifferenceequation:
[ ] [ ] [ 1] [ 2] [ 3] [ 4] [ 5]y n x n x n x n x n x n x n= + − + − + − + − + −
1 2 3 4 5( ) ( ) ( ) ( ) ( ) ( ) ( )Y z X z z X z z X z z X z z X z z X z− − − − −= + + + + +
5 4 3 21 2 3 4 5
5
( ) 1( ) 1( )
Y z z z z z zH z z z z z zX z z
− − − − − + + + + += = + + + + + =
Zeros: 5 4 3 21 2,3 4,51 0 1, 0.5 0.866, 0.5 0.866z z z z z z z j z j+ + + + + = ⇒ = − = ± = − ±
Poles: 5 0 0z z= ⇒ = Fivepolesatzero
Thefrequencyresponseshowsalowpassfilter,butitdoesnotmatchanyofthesixcandidatemagnituderesponses.
MATLABcode:
%S1 %feedforwardCoeffs = [ 1/2 1/2 ]; %feedbackCoeffs = [ 1 -0.9 ]; %------------------------------------------ %S2 %feedforwardCoeffs = [ 9 10 ]; %feedbackCoeffs = [ 1 0.9 ]; %------------------------------------------- %S3 %feedforwardCoeffs = [ 1/2 -1/2 ]; %feedbackCoeffs = [ 1 0.9 ]; %------------------------------------------- %S4 %feedforwardCoeffs = [ 1/4 1 3/2 1 1/4 ]; %feedbackCoeffs = 1; %------------------------------------------- %S5 %feedforwardCoeffs = [ 1 -1 1 -1 1 ]; %feedbackCoeffs = 1; %-------------------------------------------
Fall2018EE313Homework7solution|TheUniversityofTexasatAustin
%S6 %feedforwardCoeffs = [ 1 1 1 1 ]; %feedbackCoeffs = 1; %------------------------------------------- %S7 feedforwardCoeffs = [ 1 1 1 1 1 1 ]; feedbackCoeffs = 1; %------------------------------------------- figure; zplane(feedforwardCoeffs, feedbackCoeffs); W = -pi : 0.001 : pi; [H, W] = freqz( feedforwardCoeffs, feedbackCoeffs, W ); figure; plot(W, abs(H)); xlim([-pi pi]) xlabel('Radian Frequency') ylabel('Magnitude')
Problem2:a)ThissystemisformedbycascadingtwoLTIsystems.Inthez-domain:
12 1
2
( ) ( ) ( )( ) ( ) ( ) ( ) ( ) ( )
( ) ( ) ( )W z H z X z
Y z H z H z X z H z X zY z H z W z
=⎧⇒ = =⎨
=⎩
2 1( ) ( ) ( )H z H z H z=
b) 15[ ] [ ] [ 1]6
y n x n x n= + −
11
5( ) ( ) ( )6
Y z X z z X z−= +
111
( ) 5( ) 1( ) 6
Y zH z zX z
−= = +
( )1 2 1 1 2 32 1
5 7 2 5( ) ( ) ( ) 1 2 1 16 6 3 6
H z H z H z z z z z z z− − − − − −⎛ ⎞= = − + + = − − +⎜ ⎟⎝ ⎠
c) ( ) ( ) ( )Y z H z X z=
7 2 5[ ] [ ] [ 1] [ 2] [ 3]6 3 6
y n x n x n x n x n= − − − − + −
d)MATLABcode
h1=[15/6];h2=[1-21];h=conv(h2,h1);zplane(h)
Fall2018EE313Homework7solution|TheUniversityofTexasatAustin
e) [ ] [ ]y n x n= so ( ) ( ) ( ) 1Y z X z H z= ⇒ =
f)Accordingtoparte,H(z)=1toguaranteeinputandoutputareequal.Also,frompart(b)
2 1( ) ( ) ( )H z H z H z=
12
51 ( ) 16
H z z−⎛ ⎞= +⎜ ⎟⎝ ⎠
21
1( ) 516
H zz−
=+
g)H2willbestableifitspolesareinsidetheunitcircle.H2(z)isinverseofH1(z),sozerosofH1(z)arepolesofH2(z).Therefore,zerosofH1(z)shouldbeinsidetheunitcircle.
Epilog:Parts(f)and(g)concernthedesignoffilterH2compensateforthefrequencydistortionintroducedbyfilterH1.Equalizingfrequencydistortioninanunknownsystemhasmanyapplications,includingdisplay/printingofimages,calibratingbiomedicalinstrumentation,compensatingphasedistortioninananalog-to-digitalconverter,andcommunicationreceivers.Inacommunicationreceiver,thechannelequalizercompensatesforfrequencydistoritoninthecommunicationchannelaswellasintheanalog/RFcircuitsinthetransmitterandreceiver.