当前位置: > 在设计FIR滤波器时遇到点问题,...
题目
在设计FIR滤波器时遇到点问题,
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.
具体该怎么解决那?
运行了还是一样的!
Error using ==> fir1 at 92
The window length must be the same as the filter length.
Error in ==> ex723 at 6
hn=fir1(M,wp,'stop',blackman(M));

提问时间:2021-04-01

答案
先看下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)
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
版权所有 CopyRight © 2012-2019 超级试练试题库 All Rights Reserved.