实验三:
第一题(书上有参考代码,不再赘述)
运行结果:
第二题:
源代码:
num=[-1 0.4 0.45]; den=[0.45 0.4 -1]; [z,p,k]=tf2zp(num,den); n=0:20;
x=2.*0.9.^n.*[n>=0]; y=filter(num,den,x);
subplot(2,2,1); zplane(z,p); w=[0:1:512]*pi/512; H=freqz(num,den,w); magH=abs(H);phaH=angle(H);
10
subplot(2,2,2);plot(w/pi,magH);grid; xlabel('?μ?ê μ¥??:pi');ylabel('·ù?è'); title('?μ?ê?ìó|');
subplot(2,2,3); plot(w/pi,phaH);grid;
xlabel('?μ?ê μ¥??:pi');ylabel('?à??'); title('?à???ìó|');
subplot(2,2,4); plot(n,y);grid;
xlabel('n');ylabel('y'); title('y(n)');
运行结果:
11
实验四:
第一题(书上有参考代码,不再赘述) 运行结果: DFT:
DTFT:
12
第二题:
(1)源代码:
n=0:15;
x=n.*(1./n).*[n<5]; x(1)=1;
k=-200:200; w=(pi/100)*k;
y=x*(exp(-j*pi/100)).^(n'*k);
subplot(4,1,1); stem(n,x);
title('resource');
subplot(4,1,2); stem(w/pi,abs(y)); title('magnitude');
subplot(4,1,3); stem(w/pi,angle(y)); title('phase');
13
运行结果:
(2)源代码:
N=10; n=0:9;
x=n.*(1./n).*[n<5]; x(1)=1;
y=fft(x,N); x1=ifft(y,N);
subplot(4,1,1); stem(n,x);
title('original signal');
subplot(4,1,2); stem(n,abs(y)); title('magnitude');
subplot(4,1,3);
14