贵州大学-MATLAB数字信号处理课程设计
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])
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%带通滤波器 fpl=150;fpu=250;fsl=100;fsu=500;fs=5000; wp=[2*fpl/fs,2*fpu/fs];ws=[2*fsl/fs,2*fsu/fs]; rp=1;rs=40;
[N,wpo]=ellipord(wp,ws,rp,rs); [B,A]=ellip(N,rp,rs,wpo); [HK,w]=freqz(B,A,512); subplot(5,1,3);
plot(w/(2*pi)*fs,HK);grid on title('带通滤波器'); ylabel('幅度/db'); xlabel('频率单位(HZ)'); axis([0,500,-1,1]);
%%%%%%%%%%%%%%%%%%%%%%%%%%%滤波 M=filter(B,A,y); subplot(5,1,4); plot(M);
title('带通滤波器滤波后信号');