Skip to content

Include a zpk2tf function #749

Description

@ovega14

As it stands, a function that takes zeroes, poles, gain into numerator, denominator transfer function coefficient arrays only lives in scipy.signal or can be imported from control.matlab, and used to create a transfer function my_tf as follows:
my_tf= tf(*zpk2tf(...))
Why not instead can python-control have a method that directly takes zeroes, poles, gain into a transfer function, i.e.
my_tf=zpk2tf(..)?

Activity

  1. sawyerbfuller commented on Jul 16, 2022

    @sawyerbfuller
    Contributor

    Hi @ovega14 I agree it would be very nice to have this functionality outside of the matlab module.

    Its not clear to me how we could implement that functionality inside TransferFunction because the three-argument case is already taken by TransferFunction(num, den, dt). Might be possible to include a keyword to make it explicit like TransferFunction(zeros, poles, gain, [dt,] usezpk=True), but implementing that logic seems like it would be awkward.

    Probably most expedient is to just move the import of scipy's zpk2tf (and might as well bring in zpk2ss while you're at it) into the LTI module rather than the matlab module, and then they will be available everywhere, including the matlab module.

    This might be an opportunity to also invent a more pythonic additional long name for them as well, e.g. zeros_poles_gain_to_tf, but they are so apt and convenient I am not sure that is necessary.

    Feel free to contribute a pull request.

  2. murrayrm commented on Jul 16, 2022

    @murrayrm
    Member

    Whoever takes on implementing this should make sure that zpk2tf and zpk2ss eventually create a NamedIOSystem, versus a lower level TransferFunction or StateSpace object. That will allow the output system to be compatible with the I/O system functionality (including named input/output signals for connecting things together). A diagram of the dependencies can be found here.

  3. ovega14 commented on Jul 21, 2022

    @ovega14
    Author

    Should we import zpk2tf and zpk2ss from scipy into the LTI module? If so, then these functions will not directly return a NamedIOSystem, nor a TransferFunction or StateSpace object. As a reminder, these functions return numerator and denominator coefficient arrays of a transfer function given zeroes, poles, and gain. Should we then redefine the two functions (zpk2tf and zpk2ss) to conform to this expected python-control behavior?

  4. bnavigator commented on Jul 21, 2022

    @bnavigator
    Contributor

    Yes functions in the control namespace should return a python-control conforming system. Hence @murrayrm's request to return NamedIOSystem. This requires a wrapper rather than a simple import.

  5. linked a pull request that will close this issueadd zpk() function #816on Dec 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions