Matlab - “Buttord”函数返回负序

时间:2013-10-20 20:13:49

标签: matlab filter

我的按钮功能有问题,我想我不知道它是如何工作的。我正在传递一些参数并获得过滤器的负序。这怎么可能?我正在构建一个模拟低通滤波器,其通带结束于1500Hz,阻带从2000Hz开始。纹波要求以dB为单位,不确定是否有任何变化。我一直在查看Matlab文档,但无法找到代码的错误。

这是我的代码:

rbp = 0.10; %pass band ripple requierement 
rbs = 0.05; %stop band ripple

fp = 1500; %pass band freq
fs = 2000; %stop band freq

Wp = 2*pi*fp; % change to rad/sec
Ws = 2*pi*fs;

[N, Wn] = buttord(Wp,Ws,rbp,rbs,'s') %yields N = -1

谢谢!

1 个答案:

答案 0 :(得分:2)

你错误地将rbs解释为阻带波纹。实际上它代表阻带最小衰减,因此它应具有更高的值。例如,设置。rbs=20(dB)会产生N=15

来自help buttord

[N, Wn] = BUTTORD(Wp, Ws, Rp, Rs) returns the order N of the lowest 
order digital Butterworth filter that loses no more than Rp dB in 
the passband and has at least Rs dB of attenuation in the stopband.  
Wp and Ws are the passband and stopband edge frequencies, normalized 
from 0 to 1 (where 1 corresponds to pi radians/sample).