[SciPy-Dev] trying to understand how zi is used in lfilter

Robert Dodier dodier at ohsu.edu
Tue Nov 6 22:03:46 EST 2018


Hi,

I working on translating scipy.signal.lfilter into another programming language (or at least enough of it for the current project). I am looking at the source code of Scipy 1.1.0 for that purpose.

lfilter takes an optional argument zi. I see that lfilter_zi can compute a value for zi, and in the examples I've found, lfilter is called with zi = zi_foo * x[0] where zi_foo is the output from lfilter_zi and x[0] is the first input datum. 

I understand that zi represents the steady state value for the filter and that's great, no problem there. What I don't understand is how zi is taken into account in lfilter.

lfilter punts to sigtools._linear_filter, which punts to RawFilter, and at that point I can't figure out what's going on anymore. 

Can anyone guide me to any description of the use of zi in lfilter, _linear_filter, or RawFilter? A formula, some comments, a Wikipedia page, anything would be very helpful.

Thanks very much for any light you can shed on this question.

Robert Dodier


More information about the SciPy-Dev mailing list