Apply filtfilt on successive blocks with initial c

2019-08-29 07:14发布

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?

0条回答
登录 后发表回答