scipy.signal.residue function - extension to z, p, k input
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/55cb112a50e221f11eb28f106ba11272890c3... 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
This sounds like a useful complement to our existing residue/residuez functions. For consistency with our other ZPK functions, a name like residue_zpk would fit better than residues. Eric On Tue, Oct 10, 2017 at 8:24 AM, Leonhard Neuhaus < neuhaus@spectro.jussieu.fr> wrote:
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/55cb112a50e221f11eb28 f106ba11272890c3b7f/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
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
participants (2)
-
Eric Larson
-
Leonhard Neuhaus