贵州大学-MATLAB数字信号处理课程设计
subplot(5,1,2);
plot((0:1023)*2500/1024,abs(z(1:1024)));grid on title('产生信号的频谱分析'); ylabel('幅度');
xlabel('频率单位(HZ)') axis([0,800,0,1500])
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%低通滤波器 wp=2*100/Fs;ws=2*150/Fs;Rp=2;As=30; [N,wc]=buttord(wp,ws,Rp,As); [B,A]=butter(N,wc); [HK,f]=freqz(B,A,512,Fs); subplot(5,1,3);
plot(f,20*log(abs(HK)));grid on title('低通滤波器'); ylabel('幅度/db'); xlabel('频率单位(HZ)'); axis([0,200,-50,1]);
%%%%%%%%%%%%%%%%%%%%%%%%%%%滤波 M=filter(B,A,y); subplot(5,1,4); plot(M);
title('低通滤波器滤波后信号'); ylabel('幅度/db'); xlabel('频率单位(HZ)'); axis([0,1000,-3,3])
%%%%%%%%%%%%%%%%%%%%%%%%%滤除后信号的频谱 z=fft(M,2048); subplot(5,1,5);
plot((0:1023)*2500/1024,abs(z(1:1024)));grid on