Im trying to animate multiple points around multiple parametric plots which depicts orbital motion of body around a planet. Initial conditons are;
μ = 3.986004418*10^14
a = {7.92597218162462`*^6, 7.359004757830201`*^6,
6.970300551929753`*^6}
r = {7.388961739897817`*^6, 7.352270990873303`*^6,
6.989358622500435`*^6}
v = {7589.490674834727`, 7366.424498576473`,7541.464522475139`}
Ecc = {0.014, 0.025, 0.03}(*eccentricity*)
RAAN = {150, 160, 170}
Inc = {20, 80, 320}
ArgPer = {220, 110, 330}
The following parametric equations are
Table[{x[t] =
a[[i]] (1 - Ecc[[i]]^2)/(1 + Ecc[[i]]*Cos[t])*Cos[t],{y[t] =
a[[i]] (1 - Ecc[[i]]^2)/(1 + Ecc[[i]]*Cos[t])*Sin[t]}}, {i, 1, 3}]
which are used in NDSolve
orbsoln =
Table[NDSolve[{(x''[
t] + (μ*(x[t][[i]]))/((x[t][[i]])^2 + (y[t][[i]])^2)^(3/2) ==
0, (y''[
t] + (μ* (y[t][[i]]))/((x[t][[i]])^2 + (y[t][[i]])^2)^(3/2) ==
0, x[0] == r[[j]], y[0] == 0,
Derivative[1][x][0] == 0, Derivative[1][y][0] == v[[j]]}, {x ,
y}, {t, 0, 2 Pi}], {j, 1, 3}]
The results are then plotted using Animate and rotated into plane using an euler rotation matrix
EulerRotationMatrix[{i_, Ω_, ω_}] := RotationMatrix[
i, {0, 0, 1}].RotationMatrix[Ω, {0, 1,
0}].RotationMatrix[ω, {0, 0, 1}];
plot = Table[
ParametricPlot3D[
Evaluate[(EulerRotationMatrix[{RAAN[[m]] Degree, Inc[[m]] Degree,
ArgPer[[m]] Degree}].{x[t], y[t], 0}) /. First[orbsoln]], {t,
0, 2 Pi}, PlotRange -> 0.8*10^7], {m, 1, 3}]
Animate[Show[plot,
Graphics3D[{PointSize[0.02], Red,
Point[Table[
Evaluate[(EulerRotationMatrix[{RAAN[[o]] Degree,
Inc[[o]] Degree, ArgPer[[o]] Degree}].{x[t], y[t], 0}) /.
First[orbsoln]], {o, 1, 3}]]}]], {t, 0, 2 Pi}]
I'm aiming to show 3 points following their parametric path that has been defined by NDsolve
, but all i get is this plot;
and the error message
Coordinate {{{6.978455209925671*^6, 1.4717698904511775*^6, 1.9318209890130716*^6}}, {{-1.9573444509619826]^6, -6.669739440694639^6, 2.5060436058655437*^6}}, {{-4.195765089771511*^6, 4.47488342280073*^6, 4.119204986980711*^6}}} should be a triple of numbers, or a Scaled form.
Can anyone point out where I have gone wrong?