Skip to content

Create matlab's equivalent to bandwidth. #690

Description

@Kreijstal

Is it possible to create matlab's equivalent to bandwidth in control?
https://www.mathworks.com/help/control/ref/lti.bandwidth.html
or are there any alternatives available?

Activity

  1. murrayrm commented on Jan 9, 2022

    @murrayrm
    Member

    Definitely possible, although this can also be done with the output from bode_plot and the Numpy argmin function, I suspect.

    If you (or someone) want to contribute code to do this, we can put it either in the main package or in the MATLAB compatibility module.

  2. Kreijstal commented on Jan 10, 2022

    @Kreijstal
    Author

    Here is roughly how I solved it for me, I don't have time for providing a pull request, but maybe someone writing the pull request can get inspired.

    import scipy
    import numpy as np
    def bandwidth(sys,dbgain=-3):
      result=scipy.optimize.root(lambda s:control.matlab.freqresp(sys,s)[0][0]-control.matlab.dcgain(sys)*10**(dbgain/20),1)
      if result.success:
        return np.abs(result.x)[0]
      else:
        raise Exception(result.message)
  3. roryyorke commented on Jul 14, 2024

    @roryyorke
    Contributor

    Looks like merged #889 closes this?

  4. Kreijstal commented on Jul 14, 2024

    @Kreijstal
    Author

    I have not used control in years, but I am happy it got solved

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