clear all;
close all;
fs=2500;
fp=99,fc=105;
wp=2*pi*fp/fs;
ws=2*pi*fc/fs;
Bt=ws-wp;
N0=ceil(6.6*pi/Bt);
N=N0+mod(N0+1,2);
wc=(wp+ws)/2/pi;
hn=fir1(N-1,wc,hamming(N));
freqz(hn,1,512);
%%
f1=30;f2=45;f3=80;f4=93;f5=99;f6=130;
t=0:0.01:2;
x=0.5*cos(2*pi*f1*t)+0.3*cos(2*pi*f2*t)+0.2*cos(2*pi*f3*t)+0.7*cos(2*f4*pi*t)+0.8*cos(2*pi*f5*t)+0.6*cos(2*pi*f6*t);
figure(5);
subplot(211)
plot(t,x);
y=filter(hn,1,x);
title('滤波前信号');
subplot(212)
plot(t,y);
title('滤波后信号');