您好,欢迎访问三七文档
Project2.3LinearandNonlinearSystems线性和非线性系统:假定系统为:0.410.7522.24032.490812.24032ynynynxnxnxn(2.1)用程序仿真该系统,输入三个不同的输入序列1xn,1xn和12xnaxnbxn计算并求出相应的输出相应1yn,2yn,ynAcopyofProgramP2_3isgivenbelow:Insertprogramcodehere.Copyfromm-file(s)andpaste.%Generatetheinputsequencesclf;n=0:40;a=2;b=-3;x1=cos(2*pi*0.1*n);x2=cos(2*pi*0.4*n);x=a*x1+b*x2;num=[2.24032.49082.2403];den=[1-0.40.75];ic=[00];%Setzeroinitialconditionsy1=filter(num,den,x1,ic);%Computetheoutputy1[n]y2=filter(num,den,x2,ic);%Computetheoutputy2[n]y=filter(num,den,x,ic);%Computetheoutputy[n]yt=a*y1+b*y2;d=y-yt;%Computethedifferenceoutputd[n]%Plottheoutputsandthedifferencesignalsubplot(3,1,1)stem(n,y);ylabel('Amplitude');title('OutputDuetoWeightedInput:a\cdotx_{1}[n]+b\cdotx_{2}[n]');subplot(3,1,2)stem(n,yt);ylabel('Amplitude');title('WeightedOutput:a\cdoty_{1}[n]+b\cdoty_{2}[n]');subplot(3,1,3)stem(n,d);xlabel('Timeindexn');ylabel('Amplitude');title('DifferenceSignal');Y=filter(B,A,X),输入X为滤波前序列,Y为滤波结果序列,B/A提供滤波器系数,B为分子,A为分母Answers:Q2.7Theoutputsy[n],obtainedwithweightedinput,andyt[n],obtainedbycombiningthetwooutputsy1[n]andy2[n]withthesameweights,areshownbelowalongwiththedifferencebetweenthetwosignals:运行程序P2_3.m,将由加权输入得到的yn与ytn进行比较,ytn是在相同权系数下输出1yn和2yn相加得到的。这两个序列和他们的差异显示如下:InsertMATLABfigure(s)here.Copyfromfigurewindow(s)andpaste.0510152025303540-50050AmplitudeOutputDuetoWeightedInput:ax1[n]+bx2[n]0510152025303540-50050AmplitudeWeightedOutput:ay1[n]+by2[n]0510152025303540-505x10-15TimeindexnAmplitudeDifferenceSignal两个序列是否相等?答:相等该系统是否是线性系统?答:是线性系统Q2.8ProgramP2_3wasrunforthefollowingthreedifferentsetsofvaluesoftheweightingconstants,aandb,andthefollowingthreedifferentsetsofinputfrequencies:用一组不同的权系数a和b的值以及一组不同的输入频率重做习题Q2.7,将结果显示如下:Theplotsgeneratedforeachoftheabovethreecasesareshownbelow:将a和b及x1、x2分别改为a=5;b=-10;x1=cos(2*pi*0.2*n);x2=cos(2*pi*0.8*n);InsertMATLABfigure(s)here.Copyfromfigurewindow(s)andpaste.0510152025303540-1000100AmplitudeOutputDuetoWeightedInput:ax1[n]+bx2[n]0510152025303540-1000100AmplitudeWeightedOutput:ay1[n]+by2[n]0510152025303540-505x10-14TimeindexnAmplitudeDifferenceSignalBasedontheseplotswecanconcludethatthesystemwithdifferentweightsis–线性的Q2.9Program2_3wasrunwiththefollowingnon-zeroinitialconditions–用下面的初始条件:ic=[01];Theplotsgeneratedareshownbelow–结果显示:InsertMATLABfigure(s)here.Copyfromfigurewindow(s)andpaste.0510152025303540-20020AmplitudeOutputDuetoWeightedInput:ax1[n]+bx2[n]0510152025303540-50050AmplitudeWeightedOutput:ay1[n]+by2[n]0510152025303540-202TimeindexnAmplitudeDifferenceSignalBasedontheseplotswecanconcludethatthesystemwithnonzeroinitialconditionsis–在这个基础上我们知道,当初始条件不是零的时候系统是线性系统吗?答:不是线性系统Q2.11ProgramP2_3wasmodifiedtosimulatethesystem:假定一个系统为:y[n]=x[n]x[n–1]Theoutputsequencesy1[n],y2[n],andy[n]oftheabovesystemgeneratedbyrunningthemodifiedprogramareshownbelow:修改程序P2_3.m,计算这个系统的输出序列y1[n],y2[n],andy[n]。比较y[n]withyt[n]是否相等,结果显示如下:InsertMATLABfigure(s)here.Copyfromfigurewindow(s)andpaste.Comparingy[n]withyt[n]weconcludethatthetwosequencesare–都不是线性系统Thissystemis–这个系统是线性系统吗?答:不是Project2.4Time-invariantandTime-varyingSystems时不变和时变系统用程序P2_4.m仿真(2.1)式中给出的系统,以产生两个不同的输入序列,计算并画出相应的输出序列。AcopyofProgramP2_4isgivenbelow:Insertprogramcodehere.Copyfromm-file(s)andpaste.%Generatetheinputsequencesclf;n=0:40;D=10;a=3.0;b=-2;x=a*cos(2*pi*0.1*n)+b*cos(2*pi*0.4*n);xd=[zeros(1,D)x];num=[2.24032.49082.2403];den=[1-0.40.75];ic=[00];%Setinitialconditions%Computetheoutputy[n]y=filter(num,den,x,ic);%Computetheoutputyd[n]yd=filter(num,den,xd,ic);%Computethedifferenceoutputd[n]d=y-yd(1+D:41+D);%Plottheoutputssubplot(3,1,1)stem(n,y);ylabel('Amplitude');title('Outputy[n]');grid;subplot(3,1,2)stem(n,yd(1:41));ylabel('Amplitude');title(['OutputduetoDelayedInputx[n?',num2str(D),']']);grid;subplot(3,1,3)stem(n,d);xlabel('Timeindexn');ylabel('Amplitude');title('DifferenceSignal');grid;Answers:Q2.12Theoutputsequencesy[n]andyd[n-10]generatedbyrunningProgramP2_4areshownbelow–运行程序P2_4.m并比较y[n]andyd[n-10],这两个序列有什么关系?该系统是时不变系统吗?InsertMATLABfigure(s)here.Copyfromfigurewindow(s)andpaste.0510152025303540-50050AmplitudeOutputy[n]0510152025303540-50050AmplitudeOutputduetoDelayedInputx[n?10]0510152025303540-101TimeindexnAmplitudeDifferenceSignalThesetwosequencesarerelatedasfollows-yd[n-10]是由y[n]向右平移10个单位得到的Thesystemis–线性时不变系统Q2.13Theoutputsequencesy[n]andyd[n-D]generatedbyrunningProgramP2_4forthefollowingvaluesofthedelayvariableD–用一个不同的延时变量D,重做习题Q2.12,结果显示如下:areshownbelow–将D改为20InsertMATLABfigure(s)here.Copyfromfigurewindow(s)andpaste.0510152025303540-50050AmplitudeOutputy[n]0510152025303540-50050AmplitudeOutputduetoDelayedInputx[n?20]0510152025303540-101TimeindexnAmplitudeDifferenceSignalIneachcase,thesetwosequencesarerelatedasfollows–由y[n]向右平移20个单位得到Thesystemis–线性时不变系统Q2.14Theoutputsequencesy[n]andyd[n-10]generatedbyrunningProgramP2_4forthefollowingvaluesoftheinputfrequencies-用一个不同的输入,重做习题Q2.12,结果显示如下:areshownbelow-InsertMATLABfigure(s)here.Copyfromfigurewindow(s)andpaste.Ineachcase,thesetwosequencesa
本文标题:DSP第二次实验
链接地址:https://www.777doc.com/doc-3538558 .html