Thread: ode45 Matlab
View Single Post
  #7  
Old November 29th, 2008, 10:21 PM
Rapha Rapha is offline
Senior Member
 
Join Date: Nov 2008
Posts: 400
Thanks: 57
Thanked 149 Times in 142 Posts
Rapha has a spectacular aura aboutRapha has a spectacular aura about
Default

Quote:
Originally Posted by CaptainBlack View Post
Somewere in the staement of the problem there should be initial values.
Oooops
I forgot to post them :-(

Quote:
Originally Posted by CaptainBlack View Post
the following seems to work on FreeMat:

Code:
function dx=deriv(t,x)
   d1=sqrt(((x(1)+0.1)^2+x(2)^2)^3);
   d2=sqrt(((x(1)-0.9)^2+x(2)^2)^3);
   dx=zeros(4,1);
   dx(1)=x(3);
   dx(2)=x(4);
   dx(3)=x(1)-2*x(4)-0.9*(x(1)+0.1)/d1-0.1*(x(1)-0.9)/d2;
   dx(4)=x(2)-2*x(3)-0.9*x(2)/d1-0.1*x(2)/d2;
with calling statement:
Alright, thank you. You are great!

Rapha

Last edited by Rapha; November 29th, 2008 at 10:44 PM.
Reply With Quote