1程序清单及波形显示:clc;closeall;clearall;%======内容1:调用filter解差分方程,由系统对u(n)的响应判断稳定性======A=[1,-0.9];B=[0.05,0.05];%系统差分方程系数向量B和Ax1n=[11111111zeros(1,50)];%产生信号x1(n)=R8(n)x2n=ones(1,128);%产生信号x2(n)=u(n)y1n=filter(B,A,x1n);%求系统对x1(n)的响应y1(n)n=0:length(y1n)-1;subplot(2,2,1);stem(n,y1n,'.');title('(a)系统对R8(n)的响应y1(n)');xlabel('n');ylabel('y1(n)');y2n=filter(B,A,x2n);%求系统对x2(n)的响应y2(n)n=0:length(y2n)-1;subplot(2,2,2);stem(n,y2n,'.');title('(b)系统对u(n)的响应y2(n)');xlabel('n');ylabel('y2(n)');hn=impz(B,A,58);%求系统单位脉冲响应h(n)n=0:length(hn)-1;subplot(2,2,3);y=hn;stem(n,hn,'.');title('(c)系统单位脉冲响应h(n)');xlabel('n');ylabel('h(n)');020406000.20.40.60.8(a)系统对R8(n)的响应y1(n)ny1(n)05010015000.51(b)系统对u(n)的响应y2(n)ny2(n)020406000.050.1(c)系统单位脉冲响应h(n)nh(n)%===内容2:调用conv函数计算卷积============================x1n=[11111111];%产生信号x1(n)=R8(n)h1n=ones(1,10);h2n=[12.52.51];y21n=conv(h1n,x1n);y22n=conv(h2n,x1n);figure(2)n=0:length(h1n)-1;subplot(2,2,1);stem(n,h1n);title('(d)系统单位脉冲响应h1n');xlabel('n');ylabel('h1(n)');n=0:length(y21n)-1;2subplot(2,2,2);stem(n,y21n);title('(e)h1(n)与R8(n)的卷积y21n');xlabel('n');ylabel('y21(n)');n=0:length(h2n)-1;subplot(2,2,3);stem(n,h2n);title('(f)系统单位脉冲响应h2n');xlabel('n');ylabel('h2(n)');n=0:length(y22n)-1;subplot(2,2,4);stem(n,y22n);title('(g)h2(n)与R8(n)的卷积y22n');xlabel('n');ylabel('y22(n)');051000.51(d)系统单位脉冲响应h1nnh1(n)0510152002468(e)h1(n)与R8(n)的卷积y21nny21(n)01230123(f)系统单位脉冲响应h2nnh2(n)051002468(g)h2(n)与R8(n)的卷积y22nny22(n)%=========内容3:谐振器分析========================un=ones(1,256);%产生信号u(n)n=0:255;xsin=sin(0.014*n)+sin(0.4*n);%产生正弦信号A=[1,-1.8237,0.9801];B=[1/100.49,0,-1/100.49];%系统差分方程系数向量B和Ay31n=filter(B,A,un);%谐振器对u(n)的响应y31(n)y32n=filter(B,A,xsin);%谐振器对u(n)的响应y31(n)figure(3)n=0:length(y31n)-1;subplot(2,1,1);stem(n,y31n,'.');title('(h)谐振器对u(n)的响应y31n');xlabel('n');ylabel('y31(n)');n=0:length(y32n)-1;subplot(2,1,2);stem(n,y32n,'.');title('(i)谐振器对正弦信号的响应y32n');xlabel('n');ylabel('y32(n)');3050100150200250300-0.0500.05(h)谐振器对u(n)的响应y31nny31(n)050100150200250300-1-0.500.51(i)谐振器对正弦信号的响应y32nny32(n)程序清单及波形显示:%DTMF双频拨号信号产生6位电话号码%clearall;clc;tm=[1,2,3,65;4,5,6,66;7,8,9,67;42,0,35,68];%DTMF信号代表的16个数N=205;K=[18,20,22,24,31,34,38,42];f1=[697,770,852,941];%行频率向量f2=[1209,1336,1477,1633];%列频率向量TN=input('键入6位电话号码=');%输入6位数字TNr=0;%接收端电话号码初值为零forl=1:6;d=fix(TN/10^(6-l))TN=TN-d*10^(6-l);forp=1:4;forq=1:4;iftm(p,q)==abs(d);break,end%检测码相符的列号qendiftm(p,q)==abs(d);break,end%检测码相符的行号pendn=0:1023;%为了发声,加长序列x=sin(2*pi*n*f1(p)/8000)+sin(2*pi*n*f2(q)/8000);%构成双频信号4sound(x,8000);%发出声音pause(0.1)%接收检测端的程序X=goertzel(x(1:205),K+1);%用Goertzel算法计算八点DFT样本val=abs(X);%列出八点DFT向量subplot(3,2,l);stem(K,val,'.');grid;xlabel('k');ylabel('|X(k)|')%画出DFT(k)幅度axis([10500120])limit=80;%fors=5:8;ifval(s)limit,break,end%查找列号endforr=1:4;ifval(r)limit,break,end%查找行号endTNr=TNr+tm(r,s-4)*10^(6-l);enddisp('接收端检测到的号码为:')%显示接收到的字符disp(TNr)显示结果:键入6位电话号码=123456d=1d=2d=3d=4d=5d=6接收端检测到的号码为:12345651020304050050100k|X(k)|1020304050050100k|X(k)|1020304050050100k|X(k)|1020304050050100k|X(k)|1020304050050100k|X(k)|1020304050050100k|X(k)|%DTMF双频拨号信号产生8位电话号码%clearall;clc;tm=[1,2,3,65;4,5,6,66;7,8,9,67;42,0,35,68];%DTMF信号代表的16个数N=205;K=[18,20,22,24,31,34,38,42];f1=[697,770,852,941];%行频率向量f2=[1209,1336,1477,1633];%列频率向量TN=input('键入8位电话号码=');%输入8位数字TNr=0;%接收端电话号码初值为零forl=1:8;d=fix(TN/10^(8-l))TN=TN-d*10^(8-l);forp=1:4;forq=1:4;iftm(p,q)==abs(d);break,end%检测码相符的列号qendiftm(p,q)==abs(d);break,end%检测码相符的行号pendn=0:1023;%为了发声,加长序列x=sin(2*pi*n*f1(p)/8000)+sin(2*pi*n*f2(q)/8000);%构成双频信号sound(x,8000);%发出声音pause(0.1)%接收检测端的程序X=goertzel(x(1:205),K+1);%用Goertzel算法计算八点DFT样本val=abs(X);%列出八点DFT向量subplot(4,2,l);stem(K,val,'.');grid;xlabel('k');ylabel('|X(k)|')%画出DFT(k)幅度6axis([10500120])limit=80;%fors=5:8;ifval(s)limit,break,end%查找列号endforr=1:4;ifval(r)limit,break,end%查找行号endTNr=TNr+tm(r,s-4)*10^(8-l);enddisp('接收端检测到的号码为:')%显示接收到的字符disp(TNr)显示结果:键入8位电话号码=12345678d=1d=2d=3d=4d=5d=6d=7d=8接收端检测到的号码为:123456781020304050050100k|X(k)|1020304050050100k|X(k)|1020304050050100k|X(k)|1020304050050100k|X(k)|1020304050050100k|X(k)|1020304050050100k|X(k)|1020304050050100k|X(k)|1020304050050100k|X(k)|程序清单及波形显示:%时域采样理论验证程序7Tp=64/1000;%观察时间Tp=64微秒Fs=1000;T=1/Fs;M=Tp*Fs;n=0:M-1;t=n*T;A=444.128;alph=pi*50*2^0.5;omega=pi*50*2^0.5;xat=A*exp(-alph*t).*sin(omega*t);Xk=T*fft(xat,M);%M点FFT[xat)]subplot(3,2,1);stem(n,xat,'.');xlabel('n');ylabel('x1(n)');title('(a)Fs=1000Hz');k=0:M-1;fk=k/Tp;subplot(3,2,2);plot(fk,abs(Xk));title('(a)T*FT[xa(nT)],Fs=1000Hz');xlabel('\omega/hz');ylabel('(H1(ejw))');axis([0,Fs,0,1.2*max(abs(Xk))]);Fs=300;T=1/Fs;M=Tp*Fs;n=0:M-1;t=n*T;A=444.128;alph=pi*50*2^0.5;omega=pi*50*2^0.5;xat=A*exp(-alph*t).*sin(omega*t);Xk=T*fft(xat,M);%M点FFT[xat)]subplot(3,2,3);stem(n,xat,'.');xlabel('n');ylabel('x2(n)');title('(b)Fs=300Hz');k=0:M-1;fk=k/Tp;subplot(3,2,4);plot(fk,abs(Xk));title('(a)T*FT[xa(nT)],Fs=300Hz');xlabel('\omega/hz');ylabel('(H2(ejw))');axis([0,Fs,0,1.2*max(abs(Xk))]);Fs=200;T=1/Fs;M=Tp*Fs;n=0:M-1;t=n*T;A=444.128;alph=pi*50*2^0.5;omega=pi*50*2^0.5;xat=A*exp(-alph*t).*sin(omega*t);Xk=T*fft(xat,M);%M