# scipy.signal.residue¶

scipy.signal.residue(b, a, tol=0.001, rtype='avg')[source]

Compute partial-fraction expansion of b(s) / a(s).

If M is the degree of numerator b and N the degree of denominator a:

        b(s)     b s**(M) + b s**(M-1) + ... + b[M]
H(s) = ------ = ------------------------------------------
a(s)     a s**(N) + a s**(N-1) + ... + a[N]


then the partial-fraction expansion H(s) is defined as:

    r       r             r[-1]
= -------- + -------- + ... + --------- + k(s)
(s-p)   (s-p)         (s-p[-1])


If there are any repeated roots (closer together than tol), then H(s) has terms like:

  r[i]      r[i+1]              r[i+n-1]
-------- + ----------- + ... + -----------
(s-p[i])  (s-p[i])**2          (s-p[i])**n


This function is used for polynomials in positive powers of s or z, such as analog filters or digital filters in controls engineering. For negative powers of z (typical for digital filters in DSP), use residuez.

Parameters: b : array_like Numerator polynomial coefficients. a : array_like Denominator polynomial coefficients. r : ndarray Residues. p : ndarray Poles. k : ndarray Coefficients of the direct polynomial term.