Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Solving second order ODE's using ode45

tomeggintontomegginton Posts: 2Member
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?
Sign In or Register to comment.