我观察到当我提供具有陡峭过渡带的 IIR 带通滤波器时,filtfilt 会出现不良行为。具体来说,输出信号表现出过度的瞬态响应;尽管如此,如果我使用基于filter. 我想这不是涉及滤波器系数或结构的数值问题,也不是filter函数。
% design bandpass filter having transition bandwidth of 200 Hz (Fs = 8000)
bp = designfilt('bandpassiir', 'StopbandFrequency1', 50, 'PassbandFrequency1', 250,...
'PassbandFrequency2', 3600, 'StopbandFrequency2', 3800, 'StopbandAttenuation1', 30,...
'PassbandRipple', 0.1, 'StopbandAttenuation2', 30, 'SampleRate', 8000, 'DesignMethod', 'cheby2');
% check stability
assert(isstable(bp),'Unstable filter');
% apply filtfilt to a random (white) long input signal; output signal shows an undesirable transient
x = randn(2^20,1);
y = filtfilt(bp,x);
% apply 'home-made' filtfilt to the same input; output signal shows a more acceptable transient
y2 = flipud(filter(bp,flipud(filter(bp,x))));
% compare effects
figure; semilogy(abs(y-y2));
根据经验,随着过渡带变窄,效果会增加,而随着过渡带变宽,效果往往会消失。
哪里有问题?我是否错过了函数帮助中的一些建议或提示?
