您好,欢迎访问三七文档
当前位置:首页 > 建筑/环境 > 给排水/暖通与智能化 > 南通大学DSP课程设计实验及习题答案完整版(精)
南通大学DSP课程设计实验加课后习题程序实验一n=-50:50;u=(n=0;e=(0.8.^n;x1=e.*u;u1=(n=4;u2=(n=5;x2=(u1-u2;u3=(n=0;u4=(n=4;x2=(u3-u4;subplot(4,1,1;stem(n,u,'.'subplot(4,1,2;stem(n,x1,'.'subplot(4,1,3;stem(n,x2,'.'subplot(4,1,4;stem(n,x3,'.'实验二n=-100:100;x1=(n=-2&(n2;m=(-j*0.65.*pi*n;w=-2*pi:0.01:2*pi;X1=x1*exp(-j*n'*w;x=eps.^m;x2=x1.*x;X2=x2*exp(-j*n'*w;x3=(n=0&(n4;X3=x3*exp(-j*n'*w;figure(1plot(w,abs(X1;figure(2plot(w,abs(X2;figure(3plot(w,abs(X3;实验三N1=64;N2=64;N3=100;n1=0:N1-1;n2=0:N2-1;n3=0:N3-1;x1=(n1=0&(n18;X1=fft(x1,N1;a11=cos(0.5*pi.*n1;a21=cos(0.25*pi.*n1;a31=cos(0.125*pi.*n1;a12=cos(0.5*pi.*n2;a22=cos(0.25*pi.*n2;a32=cos(0.125*pi.*n2;x21=a11+a21+a31;x22=a12+a22+a32;X21=fft(x21,N1;X22=fft(x22,N2;a4=cos(0.5*pi.*n3;a5=cos(0.25*pi.*n3;a6=cos(0.125*pi.*n3;x3=a4+a5+a6;X3=fft(x3,N3N4=250;n4=0:N4-1;u1=(n4=0;u2=(n4=N4;a7=cos(0.5*pi.*n4;a8=cos(0.25*pi.*n4;a9=cos(0.125*pi.*n4;x4=a7+a8+a9;y1=u1-u2;y2=hamming(N4;x41=x4.*y1;x42=x4.*y2';X41=fft(x41,N4;X42=fft(x42,N4;figure(1stem(n1,abs(X1,'.'figure(2subplot(2,1,1;stem(n1,abs(X21,'.'subplot(2,1,2;stem(n2,abs(X22,'.'figure(3stem(n3,abs(X3,'.'figure(4subplot(2,1,1;stem(n4,abs(X41,'.'subplot(2,1,2;stem(n4,abs(X42,'.'subplot(2,1,1;stem(n,abs(X41,'.'subplot(2,1,2;stem(n,abs(X42,'.'实验四dt=0.0005;t=-0.005:dt:0.005;xa=exp(-1000*abs(t;n=-500:500;w=-3*pi:0.001:3*pi;Ts1=1/20000;Ts2=1/5000;Ts3=1/1000;x1=exp(-1000*abs(n*Ts1;x2=exp(-1000*abs(n*Ts2;x3=exp(-1000*abs(n*Ts3;X1=x1*exp(-j*n'*w;X2=x2*exp(-j*n'*w;X3=x3*exp(-j*n'*w;figure(1;plot(t,xa;figure(2subplot(3,1,1;stem(w,abs(X1subplot(3,1,2;stem(w,abs(X2subplot(3,1,3;stem(w,abs(X3实验五A=[1,-3.1836,4.6223,-3.7795,1.8136,-0.48,0.0544];B=[0.0004,0.0022,0.0056,0.0075,0.0056,0.0022,0.0004];figure(1;[H,w]=freqz(B,A;plot(w,abs(H,''figure(2;h=impz(B,A;stem(h,'.';figure(3;zplane(B,A;z=roots(Bp=roots(Ax=[-4,-2,0,-4,-6,-4,-2,-6,-6,-4,-4,-6,-6,-2,6,12,8,0,-16,-38,-60,-84,-90,-66,-32,-4,-2,-4,8,12,12,10,6,6,4,0,0,0,0,0,-2,-2,0,0,-2,-2,-2,-2,0];figure(4;y=filter(B,A,x;stem(yA=[1,-3.1836,4.6223,-3.7795,1.8136,-0.48,0.0544];B=[0.0004,0.0022,0.0056,0.0075,0.0056,0.0022,0.0004];figure(1;[H,w]=freqz(B,A;plot(w,abs(H,''figure(2;h=impz(B,A;stem(h,'.';figure(3;zplane(B,A;z=roots(Bp=roots(Ax=[-4,-2,0,-4,-6,-4,-2,-6,-6,-4,-4,-6,-6,-2,6,12,8,0,-16,-38,-60,-84,-90,-66,-32,-4,-2,-4,8,12,12,10,6,6,4,0,0,0,0,0,-2,-2,0,0,-2,-2,-2,-2,0];figure(4;y=filter(B,A,x;subplot(2,1,1;stem(xsubplot(2,1,2;stem(y实验六Fs=5000;[b,a]=butter(3,pi/4*Fs,'s';[c,d]=impinvar(b,a,Fs;[H,w]=freqz(c,d;figure(1subplot(2,1,1plot(w/pi,abs(H;ylabel('³å»÷ÏìÓ¦²»±ä·¨';[m,n]=bilinear(b,a,Fs;[M,w]=freqz(m,n;subplot(2,1,2plot(w/pi,abs(M;ylabel('Ë«ÏßÐԱ任·¨';grid;wp=0.4*pi;ws=0.5*pi;ap=3;as=20;[N,wn]=buttord(wp/pi,ws/pi,ap,as;[b,a]=butter(N,wn,'low';figure(2freqz(b,a;n=0:47;x=1+cos(pi*n/4+cos(2*pi*n/3;y=filter(b,a,x;figure(3subplot(2,1,1;plot(n,x;grid;subplot(2,1,2;plot(n,y;grid;ws=0.4*pi;wp=0.5*pi;ap=3;as=20;[N,wn]=buttord(wp/pi,ws/pi,ap,as;[b,a]=butter(N,wn,'high';figure(4freqz(b,a;n=0:47;x=1+cos(pi*n/4+cos(2*pi*n/3;y=filter(b,a,x;figure(5subplot(2,1,1;plot(n,x;grid;subplot(2,1,2;plot(n,y;grid;wp=[0.2*pi0.48*pi];ws=[0.1*pi0.55*pi];ap=3;as=20;[N,wn]=buttord(wp./pi,ws./pi,ap,as;[b,a]=butter(N,wn,'bandpass';figure(6freqz(b,a;n=0:47;x=1+cos(pi*n/4+cos(2*pi*n/3;y=filter(b,a,x;figure(7subplot(2,1,1;plot(n,x;grid;subplot(2,1,2;plot(n,y;grid;实验七N=25;wn=0.6;b=fir1(N,wn,hamming(N+1;[H,w]=freqz(b,1;figure(1n=0:N;stem(b,'.';gridfigure(2plot(w/pi,20*log10(abs(H;gridb2=fir1(N,wn,boxcar(N+1;[H2,w]=freqz(b2,1;figure(3n=0:N;stem(b2,'.';gridfigure(4plot(w/pi,20*log10(abs(H2;gridb3=fir1(N,wn,blackman(N+1;[H3,w]=freqz(b3,1;figure(5n=0:N;stem(b3,'.';gridfigure(6plot(w/pi,20*log10(abs(H3;gridN2=30;wn2=[0.30.6];b4=fir1(N2,wn2,hamming(N2+1;[H4,w]=freqz(b4,1;figure(7n=0:N;stem(b4,'.';gridfigure(8plot(w/pi,20*log10(abs(H4;grid习题一n=-12:12;x=(n=-2&(n2;x0=(2.^nx1=x.*x0;subplot(3,1,1;stem(n,x1,'.'x01=(n=-4&(n4;x02=(n-4&(n=4;x2=x02-x01;subplot(3,1,2;stem(n,x2,'.'x3=cos(0.3*pi*n;subplot(3,1,3;stem(n,x3,'.'习题二n=-50:50;N1=16;n1=0:N1-1;N2=25;n2=0:N2-1;N3=32;n3=0:N3-1;N4=50;n4=0:N4-1;w=-2*pi:0.01:2*pi;x01=(n=0;x02=(n=32;x0=x01-x02;x1=sin(0.25*n*pi.*x0;figure(1X1=dtft(x1,n,w;subplot(2,1,1;plot(w,abs(X1;subplot(2,1,2;plot(w,angle(X1;x2=sin(0.25.*n1*pi;figure(2X2=fft(x2,N1;subplot(2,1,1;stem(n1,abs(X2;subplot(2,1,2;stem(n1,angle(X2;figure(3X3=fft(x3,N2;subplot(2,1,1;stem(n2,abs(X3;subplot(2,1,2;stem(n2,angle(X3;figure(4X4=fft(x4,N3;subplot(2,1,1;stem(n3,abs(X4;subplot(2,1,2;stem(n3,angle(X4;习题三dt=0.0005;t=-0.005:dt:0.005;x0=(exp(-1000*t.*cos(2*pi*t;n=-500:500;w=-3*pi:0.001:3*pi;Ts1=1/20000;Ts2=1/5000;Ts3=1/1000;x1=(exp(-1000*n*Ts1.*cos(2*pi*n*Ts1;x2=(exp(-1000*n*Ts2.*cos(2*pi*n*Ts2;x3=(exp(-1000*n*Ts3.*cos(2*pi*n*Ts3;X1=dtft(x1,n,w;X2=dtft(x2,n,w;X3=dtft(x3,n,w;figure(1;plot(t,x0;figure(2subplot(3,1,1;plot(w,abs(X1subplot(3,1,2;plot(w,abs(X2subplot(3,1,3;plot(w,abs(X3习题四A=[1,-0.5];B=[1,2];figure(1;zplane(B,A;z=roots(Bp=roots(Afigure(2;h=impz(B,A;stem(h,'.';figure(3;[H,w]=freqz(B,A;plot(w,abs(H,''figure(4;n=0:19;x=(n=0&(n20;y=filter(B,A,
本文标题:南通大学DSP课程设计实验及习题答案完整版(精)
链接地址:https://www.777doc.com/doc-4468046 .html