# scipy.signal.residuez#

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

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

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

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

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

```        r                   r[-1]
= --------------- + ... + ---------------- + k + kz**(-1) ...
(1-pz**(-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 `residue`.

See Notes of `residue` for details about the algorithm.

Parameters
barray_like

Numerator polynomial coefficients.

aarray_like

Denominator polynomial coefficients.

tolfloat, optional

The tolerance for two roots to be considered equal in terms of the distance between them. Default is 1e-3. See `unique_roots` for further details.

rtype{‘avg’, ‘min’, ‘max’}, optional

Method for computing a root to represent a group of identical roots. Default is ‘avg’. See `unique_roots` for further details.

Returns
rndarray

Residues corresponding to the poles. For repeated poles, the residues are ordered to correspond to ascending by power fractions.

pndarray

Poles ordered by magnitude in ascending order.

kndarray

Coefficients of the direct polynomial term.