This cod demonstrates different approaches in solving IVPs of ODEs by using Symbolic MATH ‘dsolve’, MuPAD for analytic solutions and ODE45, ODE113, Simulink and via scripts using Adams-Moulton, Euler’s method to compute numeric solutions of the given 2nd order ODE.
You need just to change the embedded equation to your equation then rerun the code. The simulink file need to be rebuilt for your equation, it is so easy to do. Note that you can run the whole script or run it by sections. As default the plots will be represented on on chart, to represent them on different charts just remove the ‘hold on’ command form the first method.
Example of the equations the code can solve:
y”+y’+3*y = sin(5*t) with ICs: y(0) = 3, y'(0) = -2
Some of the plots you will get: