更新时间:2021-08-30 20:38:55
我通常会仔细研究各个函数本身-您做了一些混淆.
butter
的第一个输入已经是过滤器顺序(因此您已指定顺序10,并尝试在desginfilt
函数中指定顺序20 ...).
对于 Butterworth 滤波器,MATLAB建议使用零极点增益公式,而不是标准的a
-b
系数.这是一个示例:
I usually go over the individual functions themselves -- you did a little mix-up.
The first input to butter
is already the filter order (so you have specified order 10 and tried to specify order 20 in the desginfilt
function...).
For the Butterworth-filter, MATLAB recommends to use the zero-pole-gain formulation rather than the standard a
-b
coefficients. Here is an example:
f_low = 100; % Hz
f_high = 500; % Hz
f_sampling = 10e3; % 10kHz
assert(f_low < f_high)
f_nrm_low = f_low /(f_sampling/2);
f_nrm_high = f_heigh /(f_sampling/2);
% determine filter coefficients:
[z,p,k] = butter(4,[f_nrm_low f_nrm_high],'bandpass');
% convert to zero-pole-gain filter parameter (recommended)
sos = zp2sos(z,p,k);
% apply filter
sig_flt = sosfilt(sos,sig);
我的工作领域充满了标准值.在这里,四阶是压倒性的标准. 就您而言,您只需选择
I have filled with with standard values from my field of working. 4th order is the overwhelming standard here. In your case, you would simply go with
f_low = 200; % Hz
f_high = 213; % Hz
f_sampling = 1000; % 1kHz
f_nrm_low = f_low /(f_sampling/2);
f_nrm_high = f_heigh /(f_sampling/2);
% determine filter coefficients:
[z,p,k] = butter(15,[f_nrm_low f_nrm_high],'bandpass');
PS:不需要 type 'bandpath'
,因为如果您将数组指定为输入,则函数会意识到这一点;)
PS: the type 'bandpath'
is not required as the function is aware of this if you specify an array as input ;)