bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / signal / _signaltools / residuez
function
scipy.signal._signaltools:residuez
source: build-install/usr/lib/python3.14/site-packages/scipy/signal/_signaltools.py:3421
Signature
def residuez(b, a, tol = 0.001, rtype = avg)Summary
Compute partial-fraction expansion of b(z) / a(z).
Extended Summary
If M is the degree of numerator b and N the degree of denominator a:
b(z) b[0] + b[1] z**(-1) + ... + b[M] z**(-M) H(z) = ------ = ------------------------------------------ a(z) a[0] + a[1] z**(-1) + ... + a[N] z**(-N)
then the partial-fraction expansion H(z) is defined as
r[0] r[-1] = --------------- + ... + ---------------- + k[0] + k[1]z**(-1) ... (1-p[0]z**(-1)) (1-p[-1]z**(-1))
If there are any repeated roots (closer than tol), then the partial fraction expansion has terms like
r[i] r[i+1] r[i+n-1] -------------- + ------------------ + ... + ------------------ (1-p[i]z**(-1)) (1-p[i]z**(-1))**2 (1-p[i]z**(-1))**n
This function is used for polynomials in negative powers of z, such as digital filters in DSP. For positive powers, use residue.
See Notes of residue for details about the algorithm.
Parameters
b: array_likeNumerator polynomial coefficients.
a: array_likeDenominator polynomial coefficients.
tol: float, optionalThe tolerance for two roots to be considered equal in terms of the distance between them. Default is 1e-3. See unique_roots for further details.
rtype: {'avg', 'min', 'max'}, optionalMethod for computing a root to represent a group of identical roots. Default is 'avg'. See unique_roots for further details.
Returns
r: ndarrayResidues corresponding to the poles. For repeated poles, the residues are ordered to correspond to ascending by power fractions.
p: ndarrayPoles ordered by magnitude in ascending order.
k: ndarrayCoefficients of the direct polynomial term.
Examples
The following example computes the partial-fraction expansion of b(z) / a(z):import numpy as np from scipy import signal b = np.array([1, 0.3]) a = np.array([1, -0.75, 0.125]) r, p, k = signal.residuez(b, a) r p✓
array([0.25, 0.5 ])There is no direct term here, so `k` is empty:
k
✓array([], dtype=float64)Get `b` and `a` back with `invresz`:
signal.invresz(r, p, k)
✓(array([1. , 0.3]), array([ 1. , -0.75 , 0.125]))An example where `k` is not empty:
b = np.array([2, -1, 0.1]) a = np.array([1, -0.5]) r, p, k = signal.residuez(b, a) r, p k✓
array([ 1.6, -0.2])
See also
Aliases
scipy.signal.residuez