GithubHelp home page GithubHelp logo

Comments (3)

murrayrm avatar murrayrm commented on July 20, 2024

I think the difference in the outputs is happening because forced_response and input_output_response use different methods to carry out the simulation:

  • forced_response is intended for use with linear systems and does an exact calculation of the exponential response of the (time-discretized) input. (If you call forced_response with a nonlinear I/O system, it will call input_output_response.)
  • input_output_response works on linear or nonlinear systems and calls the SciPy solve_ivp function.

The reason you may be getting different responses is because of the default settings for solve_ivp, which uses the RK45 integrator. Since you are simulating a high-Q system right at the resonant frequency, the default integrator with the default settings is not very accurate.

You can use the solve_ivp_method keyword to the input_output_response function to play around with different integrators (I tried using LSODA but that seemed to generate bigger differences) and the solve_ivp_kwargs keyword to pass different options to scipy.integrate.solve_ivp.

from python-control.

murrayrm avatar murrayrm commented on July 20, 2024

The following call to input_output_response gives results that are very close:

t, y_io = ct.input_output_response(
     io_cavity, t, np.sin(w0*t), solve_ivp_kwargs={'rtol': 1e-5})

(the default rol for RK45 is 1e-3).

from python-control.

josujugo avatar josujugo commented on July 20, 2024

Thank you very much @murrayrm. I was sure that I was missing something.

Happy new year!

from python-control.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.