scipy 1.8.0 Pypi GitHub Homepage
Other Docs
NotesParametersReturnsBackRef
sosfilt_zi(sos)

Compute an initial state :None:None:`zi` for the sosfilt function that corresponds to the steady state of the step response.

A typical use of this function is to set the initial state so that the output of the filter starts at the same value as the first element of the signal to be filtered.

Notes

versionadded

Parameters

sos : array_like

Array of second-order filter coefficients, must have shape (n_sections, 6) . See sosfilt for the SOS filter format specification.

Returns

zi : ndarray

Initial conditions suitable for use with sosfilt , shape (n_sections, 2) .

Construct initial conditions for sosfilt for step response steady-state.

See Also

sosfilt
zpk2sos

Examples

Filter a rectangular pulse that begins at time 0, with and without the use of the :None:None:`zi` argument of scipy.signal.sosfilt .

>>> from scipy import signal
... import matplotlib.pyplot as plt
>>> sos = signal.butter(9, 0.125, output='sos')
... zi = signal.sosfilt_zi(sos)
... x = (np.arange(250) < 100).astype(int)
... f1 = signal.sosfilt(sos, x)
... f2, zo = signal.sosfilt(sos, x, zi=zi)
>>> plt.plot(x, 'k--', label='x')
... plt.plot(f1, 'b', alpha=0.5, linewidth=2, label='filtered')
... plt.plot(f2, 'g', alpha=0.25, linewidth=4, label='filtered with zi')
... plt.legend(loc='best')
... plt.show()
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

scipy.signal._signaltools.sosfilt scipy.signal._signaltools.sosfiltfilt scipy.signal._signaltools.sosfilt_zi

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /scipy/signal/_signaltools.py#3632
type: <class 'function'>
Commit: