Friday, February 13, 2015

KARI Lunar Orbiter Cont'd (2)

I noticed that with the provided trajectory .xyz file, the spacecraft would periodically speed up, slow down, then speed up again, etc.
To illustrate, here is a Octave (Matlab) plot of the spacecraft velocity:


To see why, let's take a look at the .xyz file:
2458330.207  -2956.863152  4765.437104  3027.647441
2458330.207  -2957.134383  4765.280585  3027.653452
2458330.207  -3042.98079   4756.968872  3041.183781
2458330.208  -3244.743734  4682.744325  3039.987276
2458330.209  -3525.597221  4541.81125   3018.195342
2458330.209  -3856.933379  4338.323259  2973.66722
2458330.21   -4210.611914  4078.911213  2905.378869
It seems that the time (first column) was not written with sufficient number of decimal places, causing several rows to have the same time.
So I tried to simply delete any rows with duplicated times. But this didn't work, because it caused the [b]distance[/b] between the same timestamps to vary.
In the above example, deleting duplicate .207 and .209 entries would cause the distance to jump suddenly between .207 and .208, and .209 to .21.
Since velocity=distance/time, this causes the velocity to jump suddenly also.

The solution was to recalculate all the timestamps. I simply took the total time interval between the first row of the .xyz file and the last row, and divided by the total number of .xyz entries minus 1. Then I made all the timestamps increment by this constant time interval.

This is the resulting plot:


As you can see,  there are no more gaps and moreover the velocity curve is smooth. The motion of the spacecraft in celestia.Sci is also much smoother. However, the velocities are also higher than the original; I'm still investigating why.

Continue reading...

No comments: