Matlab

Moderators: None (Apply to moderate this forum)
Number of threads: 1471
Number of posts: 2147

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Solving second order ODE's using ode45 Posted by tomegginton on 30 Nov 2012 at 6:42 AM
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?



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.