Skip to main content

Module partial_fractions

Module partial_fractions 

Source
Expand description

Partial fractions of rational transfer functions and related polynomial tools, ported from scipy.signal: residue/invres (positive powers of s or z), residuez/invresz (negative powers of z), unique_roots, deconvolve, and the zero-pole-gain conversions tf2zpk/zpk2tf.

See the book entry Partial fractions, zoom FFT and waveforms.

Structs§

PartialFractions
The partial-fraction expansion: residues r, poles p (repeated poles adjacent, ordered by magnitude) and the direct polynomial term k (highest power first for residue, increasing powers of z⁻¹ for residuez).

Enums§

RootType
How unique_roots represents a group of nearly equal roots.

Functions§

deconvolve
Inverse filtering (SciPy’s deconvolve): the quotient q and remainder r with signal = divisor ∗ q + r, q being the impulse response of signal(z)/divisor(z) for len(signal) − len(divisor) + 1 samples. It is polynomial division, so it is unstable when the divisor has zeros outside the unit circle.
invres
b(s) and a(s) from a partial-fraction expansion (SciPy’s invres); repeated poles must be adjacent. Complex results whose imaginary parts cancel to rounding are returned as real parts together with the largest imaginary part dropped.
invresz
b(z) and a(z) in negative powers of z from a partial-fraction expansion (SciPy’s invresz).
residue
The partial-fraction expansion of b(s)/a(s) in positive powers (SciPy’s residue): Σ rᵢ/(s − pᵢ) + k(s), with terms r/(s − p)^j for poles repeated within tol.
residuez
The partial-fraction expansion of b(z)/a(z) in negative powers of z (SciPy’s residuez): Σ rᵢ/(1 − pᵢz⁻¹) + k₀ + k₁z⁻¹ + ….
roots
The roots of a polynomial, highest power first (NumPy’s roots): leading zeros are dropped, trailing zeros give roots at 0, and the rest are the eigenvalues of the companion matrix. Complex-conjugate pairs are listed with the positive imaginary part first, as LAPACK does.
tf2zpk
Zeros, poles and gain of b(s)/a(s) (SciPy’s tf2zpk): both are normalised by the leading denominator coefficient, the gain is the leading numerator coefficient, and the zeros and poles are the roots of the normalised polynomials.
unique_roots
Groups nearly equal roots (SciPy’s unique_roots): going through p in order, each root not yet used takes every unused root within distance tol of it into its group; the group is represented by its mean, minimum or maximum. Returns the representatives and multiplicities.
zpk2tf
b(s) and a(s) from zeros, poles and gain (SciPy’s zpk2tf), real when the zeros and poles come in conjugate pairs.