# scipy.signal.invres¶

scipy.signal.invres(r, p, k, tol=0.001, rtype='avg')[source]

Compute b(s) and a(s) from partial fraction expansion.

If M = len(b) and N = len(a):

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

r       r             r[-1]
= -------- + -------- + ... + --------- + k(s)
(s-p)   (s-p)         (s-p[-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]
-------- + ----------- + ... + -----------
(s-p[i])  (s-p[i])**2          (s-p[i])**n

Parameters: r : ndarray Residues. p : ndarray Poles. k : ndarray Coefficients of the direct polynomial term. tol : float, optional The tolerance for two roots to be considered equal. Default is 1e-3. rtype : {‘max’, ‘min, ‘avg’}, optional How to determine the returned root if multiple roots are within tol of each other. ‘max’: pick the maximum of those roots. ‘min’: pick the minimum of those roots. ‘avg’: take the average of those roots.