您好,欢迎访问三七文档
当前位置:首页 > 临时分类 > 数字信号处理实验答案
-1-Matlab1.MATLAB2.3.4.MATLAB5.MATLABMATLAB1A=[1234]B=[3456]C=A+BD=A-BE=A.*BF=A./BG=A.^BstemABCDEFGclearall;a=[1234];b=[3456];c=a+b;d=a-b;e=a.*b;f=a./b;g=a.^b;n=1:4;subplot(4,2,1);stem(n,a);xlabel('n');xlim([05]);ylabel('A');subplot(4,2,2);stem(n,b);xlabel('n');xlim([05]);ylabel('B');subplot(4,2,3);stem(n,c);xlabel('n');xlim([05]);ylabel('C');subplot(4,2,4);stem(n,d);xlabel('n');xlim([05]);ylabel('D');subplot(4,2,5);stem(n,e);xlabel('n');xlim([05]);ylabel('E');subplot(4,2,6);stem(n,f);xlabel('n');xlim([05]);ylabel('F');subplot(4,2,7);stem(n,g);xlabel('n');xlim([05]);ylabel('G');2MATLABa)x(n)=0.8n0n15b)x(n)=e(0.2+3j)n0n15c)x(n)=3cos(0.125n+0.2)+2sin(0.25n+0.1)0n15d)c)x(n)16x16(n)=x(n+16),e)c)x(n)10x10(n)=x(n+10),clearall;N=0:15;%a)x(n)=0.8n0n15xa=0.8.^N;-2-figure;subplot(2,1,1);stem(N,xa);xlabel('n');xlim([016]);ylabel('xa');%b)x(n)=e(0.2+3j)n0n15xb=exp((0.2+3*j)*N);subplot(2,1,2);stem(N,xb);xlabel('n');xlim([016]);ylabel('xb');figure;%c)x(n)=3cos(0.125n+0.2)+2sin(0.25n+0.1)0n15xc=3*cos(0.125*pi*N+0.2*pi)+2*sin(0.25*pi*N+0.1*pi);subplot(3,1,1);stem(N,xc);xlabel('n');xlim([016]);ylabel('xc');%d)c)x(n)16x16(n)=x(n+16),k=0:3;m=0;fori=1:4forj=1:16m=m+1;n(m)=N(j)+16*k(i);x16(m)=3*cos(0.125*pi*n(m)+0.2*pi)+2*sin(0.25*pi*n(m)+0.1*pi);endendsubplot(3,1,2);stem(n,x16);xlabel('n');ylabel('x16');%e)c)x(n)10x10(n)=x(n+10),forj=1:10x10(j)=x16(j);endfori=1:3form=1:10x10(i*10+m)=x10(m);endendn=1:40;subplot(3,1,3);stem(n,x10);xlabel('n');ylabel('x10');-3-3x(n)=[1,-1,3,5],:a)x1(n)=2x(n+2)-x(n-1)-2x(n)b)51k2)kn(nx(n)xclearalln=1:4;T=4;x=[1-135];x(5:8)=x(1:4);subplot(2,1,1);stem(1:8,x);grid;fori=1:4ifi-10x1(i)=2*x(i+2)-x(i-1)-2*x(i);elsex1(i)=2*x(i+2)-x(i-1+T)-2*x(i);endendx1(5:8)=x1(1:4);subplot(2,1,2);stem(1:8,x1);grid;4xya)x(t)=sin(2t)0t10sb)x(t)=cos(100t)sin(t)0t4sta=0:0.05:10;xa=sin(2*pi*ta);subplot(2,1,1);plot(ta,xa);xlabel('t');ylabel('');tb=0:0.01:4;-4-xb=cos(100*pi*tb).*sin(pi*tb);subplot(2,1,2);plot(tb,xb);xlabel('t');ylabel('');5stepshift(n0,n1,n2)u(n-n0),n1n0n2,n1n2n0=5;ns=1;nf=10;%ns;nf=n=n0n=[ns:nf];x=[(n-n0)=0];stem(n,x);6)0.9z0.67z-1)/(1z2(1H(z)-2-1-1H(z)clearall;b=[1,sqrt(2),1];a=[1,-0.67,0.9];[h,w]=freqz(b,a);am=20*log10(abs(h));subplot(2,1,1);plot(w,am);-5-ph=angle(h);subplot(2,1,2);plot(w,ph);7{8-2-123}{23-1-3}clearall;a=[8-2-123];b=[23-1-3];c=conv(a,b);%M=length(c)-1;n=0:1:M;stem(n,c);xlabel('n');ylabel('');8h(n),0n50y(n)+0.1y(n-1)-0.06y(n-2)=x(n)-2x(n-1)clearall;N=50;a=[1-2];b=[10.1-0.06];x=[1zeros(1,N-1)];k=0:1:N-1;y=filter(a,b,x);stem(k,y);xlabel('n');ylabel('');-6-1231Va(t)200HZV(n).Vat30Hz,150Hz,170Hz,250Hz,330Hz5Va(t)=6cos(60pi*t)+3sin(300pi*t)+2cos(340pi*t)+4cos(500pi*t)+10sin(660pi*t)clear,closeall,t=0:0.1:20;Ts=1/2;n=0:Ts:20;V=8*cos(0.3*pi*t)+5*cos(0.5*pi*t+0.6435)-10*sin(0.7*pi*t);Vn=8*cos(0.3*pi*n)+5*cos(0.5*pi*n+0.6435)-10*sin(0.7*pi*n);subplot(221)plot(t,V),gridon,subplot(222)stem(n,Vn,'.'),-7-gridon,05101520-40-200204005101520-40-20020402X(n)f1=0.043f2=0.31N=100M=212clear;N=100;M=2;f1=0.043;f2=0.31;n=0:N-1;x=sin(2*pi*f1*n)+sin(2*pi*f2*n);y1=x(1:2:100);y2=decimate(x,M,'fir');figure(1);stem(n,x(1:N));title('inputsequence');xlabel('n');ylabel('fudu');figure(2);n=0:N/2-1;stem(n,y1);title('outputsequencewithoutLP');xlabel('n');ylabel('fudu');figure(3);m=0:N/M-1;stem(m,y2(1:N/M));title('outputsequencewithLP');xlabel('n');ylabel('fudu');figure(4);[h,w]=freqz(x);-8-plot(w(1:512),abs(h(1:512)));title('frequencyspectrumoftheinputsequence');xlabel('w');ylabel('fudu');figure(5);[h,w]=freqz(y1);plot(w(1:512),abs(h(1:512)));title('frequencyspectrumoftheoutputsequencewithoutLP');xlabel('w');ylabel('fudu');figure(6);[h,w]=freqz(y2);plot(w(1:512),abs(h(1:512)));title('frequencyspectrumoftheoutputsequencewithoutLP');xlabel('w');ylabel('fudu');0102030405060708090100-2-1.5-1-0.500.511.52inputsequencenfudu-9-05101520253035404550-2-1.5-1-0.500.511.52outputsequencewithoutLPnfudu05101520253035404550-1.5-1-0.500.511.5outputsequencewithLPnfudu-10-00.511.522.533.505101520253035404550frequencyspectrumoftheinputsequencewfudu00.511.522.533.5051015202530frequencyspectrumoftheoutputsequencewithoutLPwfudu-11-00.511.522.533.50510152025frequencyspectrumoftheoutputsequencewithoutLPwfudu3X(n)f1=0.043f2=0.31N=502.12clear,closeall,N=50;L=2;f1=0.043;f2=0.31;n=0:N-1;x=sin(2*pi*f1*n)+sin(2*pi*f2*n);figure(1);stem(n,x(1:N));title('inputsequence');xlabel('n');ylabel('fudu');y1=zeros(1,N*2);y1(1:2:N*2)=x;figure(2);m=0:N*L-1;stem(m,y1(1:N*L));title('outputsequence');-12-xlabel('n');ylabel('fudu');y2=interp(x,L);figure(3);m=0:N*L-1;stem(m,y2(1:N*L));title('outputsequence');xlabel('n');ylabel('fudu');figure(4);[h,w]=freqz(x);plot(w(1:512),abs(h(1:512)));title('frequencyspectrumoftheinputsequence');xlabel('w');ylabel('fudu');figure(5);[h,w]=freqz(y1);plot(w(1:512),abs(h(1:512)));title('frequencyspectrumoftheoutputsequence');xlabel('w');ylabel('fudu');figure(6);[h,w]=freqz(y2);plot(w(1:512),abs(h(1:512)));title('frequencyspectrumoftheoutputsequence');xlabel('w');ylabel('fudu');05101520253035404550-2-1.5-1-0.500.511.52inputsequencenfudu-1
本文标题:数字信号处理实验答案
链接地址:https://www.777doc.com/doc-7234244 .html