[求助]如何设计一带通(15KHZ-25KHZ)的滤波器
如何设计一带通(15KHZ-25KHZ)的数字滤波器,来消除信号噪声,望各位大侠帮忙,在线等 <P>%带通滤波<BR>%x-输入信号<BR>%fs-输入信号采样频率<BR>%N-返回点数<BR>%M-滤波器半阶数<BR>%fl-下截止频率<BR>%fh-上截止频率<BR>function xl=beltfilter(x,fs,N,M,fl,fh)</P><P>k=1:M;<BR>w=0.5+0.5*cos(pi*k/M);</P>
<P>wl=2*pi*fl/fs;<BR>wh=2*pi*fh/fs;<BR>h(1)=(wh-wl)/pi;<BR>h(2:M+1)=(sin(wh*k)-sin(wl*k))./(pi*k).*w;</P>
<P>for k=1:N<BR> kk=k-1+M;<BR> xl(k)=x(kk+1)*h(1)+sum(h(2:M+1).*(x(kk+2:kk+M+1)+x(kk:-1:kk-M+1)));<BR>end</P> <P>好象不行啊</P> 不会吧,我验证过的哦 M怎么取合适呢,对数字信号有用吗 越大滤波器性能越佳,但计算量增大 数字信号能用吗<BR> 我这本来就是数字滤波器呀.<BR>还有要注意的是返回的序列是去掉了原序列的前M点和后M点,因此,如果要求初始相位的话要进行相应的补偿.<BR> <P>??? Error using ==> unknown<BR>Matrix dimensions must agree.</P>
<P>Error in ==> beltfilter at 20<BR> xl(k)=x(kk+1)*h(1)+sum(h(2:M+1).*(x(kk+2:kk+M+1)+x(kk:-1:kk-M+1)));<BR><BR>怎么报错啊</P> 你把参数x转置一下 <P>出现错误:<BR>??? Error using ==> unknown<BR>Matrix dimensions must agree.</P>
<P>Error in ==> kong11 at 16419<BR> xl(k)=x(kk+1)*h(1)+sum(h(2:M+1).*(x(kk+2:kk+M+1)+x(kk:-1:kk-M+1)));<BR><BR>x转置后还是出错,<BR><BR>??? Index exceeds matrix dimensions.</P>
<P>Error in ==> kong11 at 16419<BR> xl(k)=(x(kk+1)*h(1))'+sum(h(2:M+1).*((x(kk+2:kk+M+1))'+(x(kk:-1:kk-M+1))'));<BR><BR><BR></P> <P>你的序列长度不够长,最少为N+2*M</P>
页:
[1]