In one of my assignments I have been given a second order equation which I have to solve in ode45. I understand that you have to convert it into 2 first order differential equations by saying x1 = x, x2 = x'. The thing I am stuck on is then passing these into ode45. If, for example x1' = x2 and x2' = G(x1, x2) how exactly would you pass both into ode45 for values of 0<t<10 with x1(0)=0 and x2(0)=1? I tried
ode45([@(x2) x2; @G
], [0;0], [10;10],[0;1]) but this didn't work, does anyone know where I have gone wrong?
0 · ·