matlabsimulinkodedifferential-equationsnumerical-integration

Matlab ODE - Simulink integrator with sum block in m-file without simulink?


Is it possible to do something like this

     ----        -------
 --->|+ |------->| 1/s |-----o--------->
     | -|        |     |     |
     ----        -------     |
       /|\                   |
         -------------------- 

in a matlab ode m-file without the usage of simulink? And if it is possible how is it done? Maybe someone has got a code snippet of something that works this way?


Solution

  • Short answer: yes it's possible, but nobody's going to do it for you. The steps would be:

    1. Write down on paper the differential equation of the system
    2. Put it in a form dy/dt = f(t,y) and write it as a MATLAB function
    3. Solve the differential equation with one of the MATLAB ode solvers, e.g. ode45 (there are plenty of examples on the documentation page)

    EDIT

    As I said it doesn't get much easier than this...

    enter image description here