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 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 invres.

Parameters:

r : array_like

Residues.

p : array_like

Poles.

k : array_like

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.
Returns:

b : ndarray

Numerator polynomial coefficients.

a : ndarray

Denominator polynomial coefficients.