[SciPy-Dev] scipy.signal.residue function - extension to z, p, k input

Leonhard Neuhaus neuhaus at spectro.jussieu.fr
Tue Oct 10 08:24:16 EDT 2017


Hi all,

I have written a function residues() which does the same as 
scipy.signal.residue, but that accepts an input in the form (zeros, 
poles, k) - k is the global prefactor - instead of the usual (b, 
a)-Polynomial form of the transfer function to transform. This was 
necessary since I wanted to do the partial fraction expansion of an 
transfer function of roughly 10th order (given in the zero-pole-form) 
and numerical imprecision issues prevented me from passing through the 
(b, a)-form. The partial fraction expansion was necessary in my case to 
decompose the transfer function into parallel biquads (opposed to the 
more common serial biquad decomposition). The way I implemented the 
transformation can be found here:

https://github.com/lneuhaus/pyrpl/blob/55cb112a50e221f11eb28f106ba11272890c3b7f/pyrpl/hardware_modules/iir/iir_theory.py#L145

This implementation does not suffer from the typical numerical 
imprecision issues associated with higher-order polynomials since the 
coefficients (i.e. the prefactors of x^n in the numerator/denominator of 
the transfer function) are never explicitly calculated.

I would be happy to prepare a proper pull-request that extends the 
residue function with the (zero, pole, k)-input option if this is 
desired. Please let me know and I will get to work.

Cheers, Leo



More information about the SciPy-Dev mailing list