5
$\begingroup$

For a personal coding project, I'm trying to model orbits of satellites around the Earth. I take in some values from a user and use them to determine the shape of the orbit. I want to model the position in the orbit as a function of time so as time moves forward in the program, I can calculate the position at regular intervals and move the satellite around the earth. The user input includes, the apogee, perigee, inclination, and the longitude of the perigee. Currently from the user input, I'm able to determine the semi-major and minor axes, the eccentricity, and the orbital period. I believe I should be able to determine the mean anomaly, eccentric anomaly, and ultimately the true anomaly from this info but I'm unsure if I have enough data to do so.

Second, I am a bit confused about how I find the mean anomaly from this. I can determine the mean motion to use in the equation $M(t)=M(t_0)+n(t−t_0)$, but what do I use as $t_0$, and how do I calculate $M(t_0)$? Can anyone provide guidance on where to go from what I have started with?

$\endgroup$
7
$\begingroup$

You don't have enough information. You need a minimum of one more value to determine the true anomaly such as the time of perihelion passage.

In general six values and a timestamp are needed to fully specify a Keplerian orbit. The reason six values and a timestamp are needed in the general case is that the two body problem is a second order differential equation in three dimensional space. This results in a system with six degrees of freedom with time as the independent variable. This is why there are six orbital elements. Five values and a timestamp can suffice if the values are specified where one of the six orbital elements has a known value. For example, the mean anomaly is zero by definition (as are the eccentric and true anomalies) at the time of perihelion passage.

| improve this answer | |
$\endgroup$
  • $\begingroup$ This is a lovely answer! Rather than getting tangled up in things about orbits it says the answer is that Newtonian mechanics needs this many initial conditions as you say, which is a much nicer & more general way of saying it I think. $\endgroup$ – tfb Oct 14 at 14:20
3
$\begingroup$

Your user need to supply you with information about mean anomaly at fixed time (epoch) $M(t_0)$, and then mean anomaly at the moment $t_1$. Or about known mean motion $n$ instead of current mean anomaly $M(t_1)$. You can also get the mean motion as square root of gravitational parameter $\mu$ divided by cube of semi-major axis, and also as $2\pi$ divided by orbital period: $$n=\sqrt{\mu/a^3} =2\pi/P$$

As you remember, you can get the true anomaly from the eccentric anomaly (https://en.wikipedia.org/wiki/True_anomaly), but cannot directly obtain the eccentric anomaly from the mean anomaly - you need to use something like newtonian algorithm for solution of the equation (https://en.wikipedia.org/wiki/Eccentric_anomaly).

I do all stuff with the following code (in C++):

const float Pi=3.1415926535897932384626433832795;
const float Eps=0.000001;  // Precision of eccentric anomaly calculation

struct Body {
  float Q,q,semi_a,semi_b,inc,ex,LAN,AP,MA,TA,period,n;  // ex - is eccentricity
};

void TrueAnomaly(Body& ast)
{
  float E=ast.MA;  // Mean anomaly for the given epoch and the given body
  float ExAn=E-(E-ast.ex*sin(E)-ast.MA)/(1.-ast.ex*cos(E));  // Initial approximation of eccentric anomaly
  while(fabs(ExAn-E)>Eps)  // Eccentric anomaly calulation
  {
    E=ExAn;
    ExAn=ExAn-(ExAn-ast.ex*sin(ExAn)-ast.MA)/(1.-ast.ex*cos(ExAn));
  }
  float cosE=cos(ExAn);
  float ta=acos((cosE-ast.ex)/(1.-ast.ex*cosE));  // True anomaly
  if(ExAn>Pi)
    ta=2.*Pi-ta;
  ta-=Pi;
  ast.TA=ta;
}

Then in main program loop:

for(int i=0;i<K1;++i)  // K1 - number of bodies
{
  aster[i].MA+=aster[i].n*koefN;  // koefN - velocity of visualisation (=1)
  if(aster[i].MA>=2*Pi)
    aster[i].MA-=2*Pi;
  TrueAnomaly(aster[i]);
}

And then I use the true anomaly for the body position drawing:

for(int i=0;i<K1;++i)
{
   float c_focal=aster[i].semi_a-aster[i].q;
   x=aster[i].semi_a*cos(-aster[i].TA)+c_focal;
   z=aster[i].semi_b*sin(-aster[i].TA);
   y=0;
   ...
}

All of this is without taking into account perturbations and the similar math.

| improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ I added a bit more MathJax formatting to your equations, can you double check that it's still okay? Thanks! $\endgroup$ – uhoh Oct 17 at 10:14
  • 1
    $\begingroup$ @uhoh Thanks! Your edition is much better! $\endgroup$ – Peter Nazarenko Oct 17 at 10:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.