dingyan 发表于 2010-9-12 10:19

我编了个滤波器,滤波效果很差,哪位能指点一下怎么修改?

我编了个滤波器,滤波效果很差,哪位能指点一下怎么修改?问题出在哪?
%滤波器设计
%x=sin(2*pi*5*t)+2*sin(2*pi*10*t)+randn(size(t))
clc;clear;
fs=1000;
t=0:1/fs:2;
x=sin(2*pi*5*t)+2*sin(2*pi*10*t)+randn(size(t));
fcuts=;
mags=;
devs=;
=kaiserord(fcuts,mags,devs,fs);
b=fir1(n,wn,ftype,kaiser(n+1,beta),'scale');
h=filter(b,1,x);
subplot(211)
plot(t,x);
subplot(212)
plot(t,h);

dingyan 发表于 2010-9-12 10:54

用其他方法了一个,效果更差了。请哪位高手指正一下。
另外,这种多通带滤波,应该首选什么方法?
clc;clear;
fs=1000
t=0:1/fs:2;
x=sin(2*pi*5*t)+2*sin(2*pi*10*t)+randn(size(t));
wn1=;
wn2=;
=butter(34,wn1,'bandpass');%频率4到11带通
x1=filter(b,a,x);
=butter(34,wn2,'stop');    %频率6到9带阻
x2=filter(n,m,x1);
subplot(311)
plot(t,x);
subplot(312)
plot(t,x1);
subplot(313)
plot(t,x2);
我是个新手,望哪位高手指点一下,急!!

c2019 发表于 2010-10-12 16:31

帮顶,嘿嘿……

吃书的老虎 发表于 2010-10-12 20:10

那位高手看看,指点一下啊,关注中。

wanyeqing2003 发表于 2010-10-12 20:38

好像是有问题。滤波效果不好。

songzy41 发表于 2010-10-12 21:09

dingyan 发表于 2010-9-12 10:19 static/image/common/back.gif
我编了个滤波器,滤波效果很差,哪位能指点一下怎么修改?问题出在哪?
%滤波器设计
%x=sin(2*pi*5*t)+2 ...

其主要原因是滤波器的要求很高,采样频率1000Hz,在5和10Hz附近有2个带通滤波器,所以计算出来的滤波器阶数为N=2234阶,滤波器的延迟为N/2,所以将有1117个样点的延迟,这便使滤波后的波形要在1117个样点后才有输出。解决方法是考虑了信号的延迟,我把程序修改如下:
fs=1000;
t=0:1/fs:3;
x=sin(2*pi*5*t)+2*sin(2*pi*10*t)+randn(size(t));
fcuts=;
mags=;
devs=;
=kaiserord(fcuts,mags,devs,fs);
b=fir1(n,wn,ftype,kaiser(n+1,beta),'scale');
h=filter(b,1,x);
subplot(211)
plot(t(1:1500),x(1:1500)); ylim([-5 5]); grid;
subplot(212)
plot(t(1118:2617),h(1118:2617)); xlim(); grid;
这样滤波器输出和输入就对应起来了。
页: [1]
查看完整版本: 我编了个滤波器,滤波效果很差,哪位能指点一下怎么修改?