def filter_is_stable(a):
"""
Check if filter coefficients of IIR filter are stable.
Parameters
----------
a: list or 1darray of number
Denominator filter coefficients a.
Returns
-------
is_stable: bool
Filter is stable or not.
Notes
----
Filter is stable if absolute value of all roots is smaller than 1,
see [1]_.
References
----------
.. [1] HYRY, "SciPy 'lfilter' returns only NaNs" StackOverflow,
http://stackoverflow.com/a/8812737/1469195
"""
assert a[0] == 1.0, (
"a[0] should normally be zero, did you accidentally supply b?\n"
"a: {:s}".format(str(a)))
# from http://stackoverflow.com/a/8812737/1469195
return np.all(np.abs(np.roots(a))<1)
评论列表
文章目录