N=15; a=0.5*(N-1); n=0:N-1; wn=pi/4; w=sin(wn*(n-a))./(pi*(n-a)); if rem(N,2)~=0; w(a+1)=wn/pi; end; w1=hamming(N); h=w.*w1'; subplot(3,2,1) stem(n,h,'.') title('图一 N=15 hamming窗设计的h(n)','FontSize',10,'FontWeight','bold'); axis([0,14,-0.1,0.3]); ylabel('h(n)'); text(0,0.15,['Made by:邱英尤'],'FontSize',10,'FontWeight','bold'); grid h1=fft(h,512); w2=2*[0:511]/512; subplot(3,2,3) plot(w2,20*log10(abs(h1))) title('图二 N=15 幅频曲线','FontSize',10,'FontWeight','bold'); xlabel('数字频率w/pi');ylabel('幅度/db'); grid subplot(3,2,5) plot(w2,angle(h1)) title('图三 N=15 相频曲线','FontSize',10,'FontWeight','bold'); xlabel('数字频率w/pi');ylabel('相角/rad'); grid; N=33; a=0.5*(N-1); n=0:N-1; wn=pi/4; w=sin(wn*(n-a))./(pi*(n-a)); if rem(N,2)~=0; w(a+1)=wn/pi; end; w1=hamming(N); h=w.*w1'; subplot(3,2,2); stem(n,h,'.'); title('图四 N=32 hamming窗设计的h(n)','FontSize',10,'FontWeight','bold'); axis([0,32,-0.1,0.3]); grid; h1=fft(h,512); w2=2*[0:511]/512; subplot(3,2,4); plot(w2,20*log10(abs(h1))) title('图五 N=32 幅频曲线','FontSize',10,'FontWeight','bold'); xlabel('数字频率w/pi');ylabel('幅度/db'); grid subplot(3,2,6) plot(w2,angle(h1)) title('图六 N=32 相频曲线','FontSize',10,'FontWeight','bold'); xlabel('数字频率w/pi');ylabel('相角/rad'); grid;