How do I use ode15s to solve two simultaneous ODE's?
3 views (last 30 days)
Show older comments
I am trying to solve two second order ODE's and plot the results. The equations describe the acceleration of a spacecraft in the 3-Body Earth-Moon system. I have converted the equations into first order and sent them through the solver, with correct initial conditions, but the result is not what it should be. The result should be a circular orbit just slightly above the Earth, the circle on the right side of the plot, but it is clearly wrong if you run the code. I am thinking the code doesn't know that the third and fourth initial condition are y position and velocity and it thinks y(3),y(4) are x''' and x''''... which they aren't. I don't know how to tell the solver that y(3),y(4) are y and y'.
1 Comment
Torsten
on 8 Apr 2016
The equations that you solve in the attached code are
x''=2*y'+x-((1-mu)*(x-mu)/(((x-mu)^2 + y^2)^(3/2)))-(mu*(x+1-mu)/((((x+1-mu)^2 + y^2))^(3/2)));
y''=-2*x'+y-((1-mu)*y)/(((x-mu)^2 + y^2)^(3/2)) - (mu*y)/((x+1-mu)^2 + y^2)^(3/2)
If they are correct, then something else must be wrong if the results are not as expected.
Best wishes
Torsten.
Answers (0)
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!