核心提示:MATLAB代做|FPGA代做|python代做-FIR滤波器...
fs=2200;
m=(0.3*200)/(fs/2);%通带宽度
M=round(8/m);%窗口宽度
N=M-1;
b=fir1(N,600/(fs/2));%fir1设计实现带通滤波器,Wn:归一化频率参数(向量) 取值(0-1)截止频率除以fs/2
[h,f]=freqz(b,1,512);%offilter频率响应
plot(f*fs/(2*pi),20*log10(abs(h)))%
xlabel('频率');
figure
subplot(211)
t=0:1/fs:1;
s=sin(2*pi*100*t)+sin(2*pi*200*t)+sin(2*pi*1000*t);
plot(t,s); %信号波形
xlabel('时间')
subplot(212)
SK=fft(s,512);
SXK=abs(SK);
f=(0:255)*fs/512;
plot(f,SXK(1:256)) %draw magnitude_frequency of sn
xlabel('频率/Hz')
figure
sf=filter(b,1,s); %滤波
subplot(211)
plot(t,sf) %draw filtered signa/st"
xlabel('时间')
axis([0.2 0.5 -2 2])
subplot(212)
SFK=fft(sf,512);
SFXK=abs(SFK);
f=(0:255)*fs/512;
plot(f,SFXK(1:256))
xlabel('频率/Hz')
联系:highspeedlogic
QQ :1224848052
微信:HuangL1121
邮箱:1224848052@qq.com
微信扫一扫: