how to use ODE45 with second order ODE

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

回答 (1 件)

KSSV
KSSV 2016 年 11 月 16 日

0 投票

この質問は閉じられています。

タグ

質問済み:

2016 年 11 月 16 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by