1,11));grid;%绘制1*11的零数组网格图;Рf=0:0.5/M:0.5-0.5/MРsubplot(122)Рplot(f,abs(h1),'b-',f,abs(h2),'g-');grid;Р2、N=20Рclear all;РN=20;Рb1=fir1(N,0.3,boxcar(N+1)); % 用矩形窗作为冲激响应的窗函数Рb2=fir1(N,0.3,hamming(N+1));% 用Hamming窗作为冲激响应的窗函数РM=128;Рh1=freqz(b1,1,M);Рh2=freqz(b2,1,M);Р% 分别求两个滤波器的频率响应;Рt=0:20;Рsubplot(121)Рstem(t,b2,'.');hold on;% 绘制火柴梗图;Рplot(t,zeros(1,21));grid;%绘制1*11的零数组网格图;Рf=0:0.5/M:0.5-0.5/MРsubplot(122)Рplot(f,abs(h1),'b-',f,abs(h2),'g-');grid;Р3、N=40Рclear all;РN=40;Рb1=fir1(N,0.3,boxcar(N+1)); % 用矩形窗作为冲激响应的窗函数Рb2=fir1(N,0.3,hamming(N+1));% 用Hamming窗作为冲激响应的窗函数РM=128;Рh1=freqz(b1,1,M);Рh2=freqz(b2,1,M);Р% 分别求两个滤波器的频率响应;Рt=0:40;Рsubplot(121)Рstem(t,b2,'.');hold on;% 绘制火柴梗图;Рplot(t,zeros(1,41));grid;%绘制1*11的零数组网格图;Рf=0:0.5/M:0.5-0.5/MРsubplot(122)Рplot(f,abs(h1),'b-',f,abs(h2),'g-');grid;