As the title says, I would like to use Mathematica in order to create an animation depicting the time-evolution of a three-dimensional (3D) orbit. To begin with, I have an ASCII file which contains the orbit data into four columns. The first column corresponds to the time, while the next three to the x, y and z coordinates respectively. Below, I present a simple code so as to visualize the orbit.
SetDirectory[" ... "];
data = ReadList["orb_3d.out", Number, RecordLists -> True];
dataOrb3D = Table[{data[[i, 2]], data[[i, 3]], data[[i, 4]]},
{i, 1, Length[data]}];
S0 = Graphics3D[Line[dataOrb3D], Axes -> True, AxesStyle ->
Directive[FontSize -> 17, FontFamily -> "Helvetica"], AxesLabel ->
{"x", "y", "z"}, BoxRatios -> {1, 1, 1}, ImageSize -> 500]
The above code produces this image:
In order to obtain the ASCII data file, please follow this link.
OK, so far so good. Now let me explain the simulation part. The orbit describes the motion of a test-particle (star) under the gravitational field of a galaxy. According to the data file, when t=0 the star must be at (x,y,z) = (0.5,0,0.5). So, I would like to plot at that point, let's say a blue dot, inside the 3D volume. Then as time evolves the blue dot which indicates the star should follow the path according to the data file moving from point to point, join them thus leaving a solid line behind it. When t=250 the simulation finishes and we should have reproduced the image I present earlier.
Honestly, I am not sure if what I described is possible with Mathematica. Anyway, it would be great, if there was also a label inside the 3D box (or above it) giving the value of the time at every step of the simulation (i.e. t = 73.27). Finally, I would also like to be able to export this simulation as an .avi or .mp4 file.
I know that I described a very ambitious project here! However, I also think that it is a very interesting topic. Many many thanks in advance and I look forward for your replies.
NDSolve
is amply able to deal with equations of motion. $\endgroup$