celestial.Kepler - EranOfek/AstroPack GitHub Wiki
Descrition
The celestial.Kepler package contains basic functions for treating the two-body problem in solving the Kepler equation.
More complete set of functions to solve the Kepler equations, manipulate orbotal elemnts, and to generate ephemeris are available in the celestial.OrbitalEl class.
Solving the Kepler equation
The package contains several functions for solving the Kepler equation for elliptic, parabolic, and hyperbolic orbits. By default, these functions use the Gaussian gravitational constant and are designed for Solar System objects. In order to adapt these functions for other systems, the user must provide the Gaussian gravitational constant of the system (see functions help). The functions are solving the Kepler equation simultaneously for multiple values of the eccentricity, time, and semi-major axis, and can solve the Kepler equation for about $10^{7}$ objects in about 1 second.
The output are the true anomaly (Nu), radius vector (R), and eccentric anomaly (E). A few examples
% Solving the Kepler equation for a single value:
T = 2451545.5;
q = 0.5;
e = 0.2;
[Nu,R,E]=celestial.Kepler.kepler_elliptic(T,q,e);
% For multiple values
T = rand(1e7);
[Nu,R,E]=celestial.Kepler.kepler_elliptic(T,q,e);
% or T, q, and e are vectors...
e = rand(1e7,1);
q = rand(1e7,1).*5;
[Nu,R,E]=celestial.Kepler.kepler_elliptic(T,q,e);
For parabolic orbits:
[Nu,R,S]=celestial.Kepler.kepler_parabolic([7.0;7.8],0.1);
or hyperbolic orbits:
[Nu,R,H,Vel]=celestial.Kepler.kepler_hyperbolic(1,1,1.1);
For very low eccentricity you can also use:
[Nu,R]=celestial.Kepler.kepler_lowecc(1,0.01,1);
In order to apply these functions to other systems, you need to calculate the Gaussian gravitational constant. This can be done using the celestial.Kepler.gauss_grav_const function.
Additional related functions include:
- celestial.Kepler.dnu_dt - Calculate dnu/dt and dr/dt for an elliptical orbit.
- celestial.Kepler.eccentric2true_anomaly - Convert Eccentric anomaly to true anomaly.
- celestial.Kepler.true2eccentric_anomaly - True anomaly to eccentric anomaly.
- celestial.Kepler.lightTimeCorrection - Calculate the c\tau' parameters required for light time convergence.
- celestial.Kepler.trueanom2pos - True anomaly, radius vector and orbital elements to a cartesian position.
- celestial.Kepler.trueanom2vel - True anomaly, radius vector and orbital elements to position and velocity.
Orbital elements
Several functions for the manipulation of orbital elements are available:
- celestial.Kepler.thiele_innes2el - Convert Thiele-Innes elements to regular orbital elements.
- celestial.Kepler.thiele_innes - Convert regular orbital elements to the Thiele-Innes elements.
- celestial.Kepler.elements_1950to2000 - B1950.0 FK4 orbital elements to J2000.0 FK5
To convert orbital elements to initial position:
celestial.Kepler.elements2position(2451545,[1 0.1 2451545 0 0 0])
``
## Kepler 3rd law
celestial.Kepler.kepler3law is a simple function for applying the Kepler 3rd law.
This function is using the cgs units.
```matlab
% To calculate the period and velocity from the semi-major axis
Res=celestial.Kepler.kepler3law(constant.SunM,'a',1e13)
% or to calculate the period and semi-major axis from the velocity
Res=celestial.Kepler.kepler3law(constant.SunM,'v',1e5)