实验一、信号的采样clc,clear;dt=0.001;tf=6;t=0:dt:tf;xa=sqrt(t)+cos(t);T=0.5;n=0:tf/T;x=sqrt(n*T)+cos(n*T);figure(1)subplot(2,1,1)plot(t,xa),gridon;title('originalimage')subplot(2,1,2)stem(n*T,x),gridon,title('digitalimage')实验二、信号与系统的时域分析差分方程为)()2()1()(21nbxnyanyany,其中8.01a,64.02a,866.0b。系统单位脉冲响应)(nha1=-0.8;a2=0.64;b=0.866;ys=0;xn=[1,zeros(1,49)];B=1;A=[1,a1,a2];xi=filtic(B,A,ys);yn=filter(B,A,xn,xi);n=0:length(yn)-1;subplot(1,1,1);stem(n,yn,'.')title('(a)');xlabel('n');ylabel('y(n)')输入x(n)=cos(n)T=0.1;z=cos(n*T);zn=conv(yn,z);figure(2);n1=1:99;stem(n1,zn,'.')实验三、系统的频域和Z域分析程序代码(画出dtft的幅度和频率谱)clc,clear;n=0:1:7;x=(0.9*exp(j*pi/3)).^n;w=0:pi/200:pi;X=x*exp(-j).^(n'*w);realX=real(X);imagX=imag(X);angX=angle(X);magX=abs(X);subplot(2,2,1);plot(w/pi,magX);gridxlabel('frequencyinpiunit');title('magnitudepart');subplot(2,2,2);plot(w/pi,realX);gridxlabel('frequencyinpiunit');title('realpart');subplot(2,2,3);plot(w/pi,imagX);gridxlabel('frequencyinpiunit');title('imaginarypart');subplot(2,2,4);plot(w/pi,angX);gridxlabel('frequencyinpiunit');title('angelpart');clc,clear;a=[1,-0.5,0.06];b=[1,1,0];m=0:length(b)-1;l=0:length(a)-1;w=0:pi/500:pi;num=b*exp(-j*m'*w);den=a*exp(-j*l'*w);H=num./den;magH=abs(H);angH=angle(H);H1=freqz(b,a,w);magH1=abs(H1);angH1=angle(H1);subplot(2,2,2);plot(w/pi,angH);grid;xlabel('w(frequencyinpiunits)');ylabel('Ïàλrad/w');subplot(2,2,1);plot(w/pi,magH);grid;xlabel('w(frequencyinpiunits)');ylabel('·ù¶È|H|');subplot(2,2,3);plot(w/pi,magH1);grid;xlabel('w(frequencyinpiunits)');ylabel('·ù¶È|H1|');subplot(2,2,4);plot(w/pi,angH);grid;xlabel('w(frequencyinpiunits)');ylabel('Ïàλrad/w');axis([0,1,-0.8,0]);figure(2);zplane(b,a);实验四、信号的频谱分析程序代码clc,clear;n=0:7;k=0:7;N=8;w=n*(2*pi)/8;x=(0.9*exp(j*pi/3)).^n;X1=[xzeros(1,8)];X2=[X1zeros(1,16)];XK=x*exp(-j*k'*w);k1=0:15;n1=0:15;w1=n1*(2*pi)/16;XK1=X1*exp(-j*k1'*w1);k2=0:31;n2=0:31;w2=n2*(2*pi)/16;XK2=X2*exp(-j*k2'*w2);w3=0:pi/200:2*pi;X=x*exp(-j*n'*w3);magX=abs(X);angX=angle(X);magXK=abs(XK);angXK=angle(XK);magXK1=abs(XK1);angXK1=angle(XK1);magXK2=abs(XK2);angXK2=angle(XK2);subplot(4,2,1);plot(w3/pi,magX);xlabel('w/pi');ylabel('·ù¶È|X|');gridon;subplot(4,2,2);plot(w3/pi,angX);xlabel('w/pi');ylabel('Ïàλrad/pi');subplot(4,2,3);stem(n,magXK);xlabel('K');ylabel('·ù¶È|XK|');subplot(4,2,4);stem(n,magXK);xlabel('K');ylabel('Ïàλrad/pi');subplot(4,2,5);stem(n1,magXK1);xlabel('K1');ylabel('·ù¶È|XK1|');subplot(4,2,6);stem(n1,magXK1);xlabel('K1');ylabel('Ïàλrad/pi');subplot(4,2,7);stem(n2,magXK2);xlabel('K2');ylabel('·ù¶È|XK2|');subplot(4,2,8);stem(n2,magXK2);xlabel('K2');ylabel('Ïàλrad/pi');实验五、IIR数字滤波器设计IIR汉宁窗低通高通低通巴特沃斯通带截止频率wp=0.2pi通带最大衰减R=1dB阻带截止频率wp=0.35pi阻带最大衰减R=10dBclc,clear;Wp=0.2;Ws=0.35;Rp=1;Rs=100;[N,Wc]=buttord(Wp,Ws,Rp,Rs);[Bz,Az]=butter(N,Wc)w=0:0.1:pi;[H,w1]=freqz(Bz,Az,w);;ang=angle(H);H=20*log10(abs(H))subplot(4,2,1);plot(w/pi,H);gridon;xlabel('\omega/\pi');ylabel('|H(e^j^\omega)|/dB');title('µÍͨÂ˲¨Æ÷')subplot(4,2,2);plot(w/pi,ang);gridon;xlabel('\omega/\pi');ylabel('Phase/dB')[Bz1,Az1]=butter(N,Wc,'high')w=0:0.1:pi;[H1,w2]=freqz(Bz1,Az1,w);ang1=angle(H1);H1=20*log10(abs(H1))subplot(4,2,3);plot(w/pi,H1);gridon;xlabel('\omega/\pi');ylabel('|H(e^j^\omega)|/dB');title('¸ßͨÂ˲¨Æ÷')subplot(4,2,4);plot(w/pi,ang1);gridon;xlabel('\omega/\pi');ylabel('Phase/dB')Wp1=[0.20.8];Ws1=[0.350.65];[N2,Wc1]=buttord(Wp1,Ws1,Rp,Rs);[Bz2,Az2]=butter(N2,Wc1,'stop')w=0:0.1:pi;[H2,w3]=freqz(Bz2,Az2,w);ang2=angle(H2);H2=20*log10(abs(H2))subplot(4,2,5);plot(w/pi,H2);gridon;xlabel('\omega/\pi');ylabel('|H(e^j^\omega)|/dB');title('´ø×èÂ˲¨Æ÷')subplot(4,2,6);plot(w/pi,ang2);gridon;xlabel('\omega/\pi');ylabel('Phase/dB')Wp1=[0.20.8];Ws1=[0.350.65];[N2,Wc1]=buttord(Wp1,Ws1,Rp,Rs);[Bz3,Az3]=butter(N2,Wc1)w=0:0.1:pi;[H3,w4]=freqz(Bz3,Az3,w);ang3=angle(H3);H3=20*log10(abs(H3))subplot(4,2,7);plot(w/pi,H3);gridon;xlabel('\omega/\pi');ylabel('|H(e^j^\omega)|/dB');title('´øͨÂ˲¨Æ÷')subplot(4,2,8);plot(w/pi,ang3);gridon;xlabel('\omega/\pi');ylabel('Phase/dB')切比雪夫1型通带截止频率wp=0.7pi通带最大衰减R=1dB阻带截止频率wp=0.5pi阻带最大衰减R=40dBclc,clear;Wp=0.7;Ws=0.5;Rp=1;Rs=40;[N,Wpo]=cheb1ord(Wp,Ws,Rp,Rs);[Bz,Az]=cheby1(N,Rp,Wpo)w=0:0.1:pi;[H,w1]=freqz(Bz,Az,w);ang=angle(H);H=20*log10(abs(H))subplot(4,2,1);plot(w/pi,H);gridon;xlabel('\omega/\pi');ylabel('|H(e^j^\omega)|/dB');title('µÍͨÂ˲¨Æ÷')subplot(4,2,2);plot(w/pi,ang);gridon;xlabel('\omega/\pi');ylabel('Phase/dB')[Bz1,Az1]=cheby1(N,Rp,Wpo,'high');w=0:0.1:pi;[H1,w2]=freqz(Bz1,Az1,w);ang1=angle(H1);H1=20*log10(abs(H1))subplot(4,2,3);plot(w/pi,H1);gridon;xlabel('\omega/\pi');ylabel('|H(e^j^\omega)|/dB');title('¸ßͨÂ˲¨Æ÷')subplot(4,2,4);plot(w/pi,ang1);gridon;xlabel('\omega/\pi');ylabel('Phase/dB')Wp1=[0.20.8];Ws1=[0.350.65];[N2,Wpo1]=cheb1ord(Wp1,Ws1,Rp,Rs);[Bz2,Az2]=cheby1(N2,Rp,Wpo1,'stop')w=0:0.1:pi;[H2,w3]=freqz(Bz2,Az2,w);ang2=angle(H2);H2=20*log10(abs(H2))subplot(4,2,5);plot(w/pi,H2);gridon;xlabel('\omega/\pi');ylabel('|H(e^j^\omega)|/dB');title('´ø×èÂ˲¨Æ÷')subplot(4,2,6);plot(w/pi,ang2);gridon;xlabel('\omega/\pi');ylabel('Phase/dB')Wp1=[0.20.8];Ws1=[0.3