问题
We have two lowpass filters with a different cutoff value:
b, a = signal.butter(2, 0.125)
b2, a2 = signal.butter(2, 0.140)
When applying the first filter to x[0:10000]
and the second to x[10000:20000]
with lfilter
, we have to use initial conditions for the output to be "continuous", as seen here in the answer of Continuity issue when applying an IIR filter on successive time-frames:
zi = lfilter_zi(b, a)
x[0:10000], zi = lfilter(b, a, x[0:10000], zi=zi)
x[10000:20000], zi = lfilter(b2, a2, x[10000:20000], zi=zi)
Question: how to do the same when applying filtfilt (forward and backwards filtering), to ensure continuity when using filters on consecutive blocks, as there is no zi
initial conditions parameter?
来源:https://stackoverflow.com/questions/52502874/apply-filtfilt-on-successive-blocks-with-initial-conditions-to-avoid-discontinu