Apply filtfilt on successive blocks with initial conditions (to avoid discontinuity)

余生长醉 提交于 2020-01-16 18:05:28

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!