仪器社区

在设计FIR滤波器时遇到点问题,怎么解决?急求

QCNAN564 2010-09-17
clear all; wlp=0.2*pi;wls=0.35*pi;wus=0.65*pi;wup=0.8*pi; B=wls-wlp; M=ceil(12*pi/B)-1; wp=[(wls+wlp)/2/pi,(wus+wup)/2/pi]; hn=fir1(M,wp,'stop',blackman(M+1)); 运行该程序会显示如下错误: ??? Error using ==> fir1 at 92 The window l... clear all; wlp=0.2*pi;wls=0.35*pi;wus=0.65*pi;wup=0.8*pi; B=wls-wlp; M=ceil(12*pi/B)-1; wp=[(wls+wlp)/2/pi,(wus+wup)/2/pi]; hn=fir1(M,wp,'stop',blackman(M+1)); 运行该程序会显示如下错误: ??? Error using ==> fir1 at 92 The window length must be the same as the filter length. 具体该怎么解决那?
评论
全部评论
三木孕堵
先看下fir1中的一段解释
For filters with a gain other than zero at Fs/2, e.g., highpass
and bandstop filters, N must be even. Otherwise, N will be
incremented by one. In this case the window length should be
specified as N+2.
即高通、带阻滤波器的阶数应该控制为奇数,因为如果阶数为偶数,则在π点必有一零点,这对于高通带阻来说是不允许的,故取阶数为奇数,而你FIR1滤波器阶数为M+1阶,所以你的M必须为偶数,所以可以将程序改为
clear all;
clc
wlp=0.2*pi;wls=0.35*pi;wus=0.65*pi;wup=0.8*pi;
B=wls-wlp;
M=ceil(12*pi/B);
M=M+mod(M,2);
wp=[(wls+wlp)/2/pi,(wus+wup)/2/pi];
hn=fir1(M,wp,'stop',blackman(M+1));
freqz(hn)
5 0 2010-09-20 0条评论 回复
就上此网14
窗的长度必须和滤波器长度一致
blackman(M+1)改为blackman(M)
7 0 2010-09-18 0条评论 回复
您可能感兴趣的社区主题
加载中...
发布 评论