To use the ode45 function in MATLAB to solve a system of ordinary differential equations, follow these steps:
main.m166 chars8 lines
main.m84 chars3 lines
main.m35 chars2 lines
The output of the ode45 function will be the time points t
at which the solution was evaluated and the corresponding solution y
to your differential equations.
main.m96 chars5 lines
This will plot the solution of y1
in red and the solution of y2
in blue as functions of time.
That's it! You have successfully used ode45 to solve a system of ordinary differential equations in MATLAB.
gistlibby LogSnag