SciPy

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 = len(b) and N = len(a), then the partial-fraction expansion H(s) is defined as:

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

         r[0]       r[1]             r[-1]
     = -------- + -------- + ... + --------- + k(s)
       (s-p[0])   (s-p[1])         (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
Returns:

r : ndarray

Residues.

p : ndarray

Poles.

k : ndarray

Coefficients of the direct polynomial term.