贵州大学-MATLAB数字信号处理课程设计
x=0:1/Fs:2*pi;
y=sin(2*pi*50*x)+sin(2*pi*200*x)+sin(2*pi*600*x);%产生低频、中频、高频信号 subplot(5,1,1);
plot(x(1:50),y(1:50));grid on title('产生的信号'); ylabel('幅度'); xlabel('时间(t)')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%傅里叶变换频谱分析 z=fft(y,2048); subplot(5,1,2);
plot((0:1023)*2500/1024,abs(z(1:1024)));grid on title('产生信号的频谱分析'); ylabel('幅度');
xlabel('频率单位(HZ)') axis([0,800,0,1000])
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%高通滤波器 ws=2*400/Fs;wp=2*500/Fs;Rp=0.1;As=40; [N,wc]=buttord(wp,ws,Rp,As); [BH,AH]=butter(N,wc,'high'); HK=freqz(BH,AH,512,Fs); subplot(5,1,3);
plot(f,20*log(abs(HK)));grid on title('高通滤波器'); ylabel('幅度/db'); xlabel('频率单位(HZ)'); axis([200,700,-70,0])
%%%%%%%%%%%%%%%%%%%%%%%%%%%滤除后的信号 M=filter(BH,AH,y); subplot(5,1,4);