SciPy

scipy.signal.invresz

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

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

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

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

             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