;芆subplot(2,1,2);plot(w,abs([Y(1:256)]));%绘制频谱图膄xlabel('Hz');ylabel('频率响应幅度');袂title('频谱图');蚈grid;莄n=8;wn=[100300]/1000;薃[B,A]=butter(n,wn);薂[H,w]=freqz(B,A,512);蝿figure(7);subplot(2,1,1);螇plot(w*2000/(2*pi),abs(H));%绘制带通频谱图羂xlabel('Hz');ylabel('频率响应幅度');节title('带通滤波器');薇grid;袅subplot(2,1,2);plot(w/pi,angle(H));蒂xlabel('Hz');ylabel('angel');肃title('相位特性');薈grid;芇y=filter(B,A,x);膅figure(8);subplot(2,1,1);plot(y);蕿xlabel('t');ylabel('x(t)');虿title('连续信号');莆grid;薅Y=fft(y,512);w=(0:255)/256*1000;芀subplot(2,1,2);plot(w,abs([Y(1:256)]));%绘制频谱图蒇xlabel('Hz');ylabel('频率响应幅度');蒄title('频谱图');羄grid;肀[B,A]=butter(8,300/1000,'high');薈[H,w]=freqz(B,A,512);袇figure(9);subplot(2,1,1);莃plot(w*2000/(2*pi),abs(H));%绘制高通频谱图螀xlabel('Hz');ylabel('频率响应幅度');薀title('高通滤波器');羅grid;袃subplot(2,1,2);plot(w/pi,angle(H));