how to use ODE45 with second order ODE
Info
This question is closed. Reopen it to edit or answer.
Show older comments
i want to use ODE 45 to check my RK4 code but I'm not sure how to implement it with these two second order ODE's
my initial conditions are:
x(1) = 1.2; y(1) = 0;
vx(1) = 0; vy(1) = -1.0493571;
t0 = 0; tf = 10;
f = 0;
N = 1000;
dt = (tf-t0)/N;
eps = 0.01;
mu1 = 1/82.45;
mu2 = 1-mu1;
r1 = (((x((((x(i)+mu1)^2 + y(i)^2)^.5);i)+mu1)^2 + y(i)^2)^.5);
r2 = (((x(i)-mu2)^2 +y(i)^2)^.5);
X(x,y,dx,dy) = @(x,y,dx,dy) 2*dy - f*dx + x - (mu2*(x+mu1))/(((x+mu1)^2 +y^2)^1.5) - (mu1*(x-mu2))/(((x-mu2)^2 +y^2)^1.5);
Y(x,y,dx,dy) = @(x,y,dx,dy) -2*dx - f*dy + y - (-mu2*y)/(((x+mu1)^2 +y^2)^1.5) - (-mu1*y)/(((x-mu2)^2 +y^2)^1.5);
I need to also create a plot of the overall position at each time step but I'm not sure what to set for my "x" and "y" in plot("x","y")
any help would be much appreciated
Answers (1)
KSSV
on 16 Nov 2016
0 votes
You may have a look into this to understand:
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!