Code covered by the BSD License
-
atan3 (a, b)
four quadrant inverse tangent
-
ceqm1 (t, y)
first order form of Cowell's equations of orbital motion
-
eci2orb1 (mu, r, v)
convert eci state vector to six classical orbital
-
eci2orb2 (mu, gst0, omega, ut...
convert eci state vector to complete set of classical orbital elements
-
gast1 (jdate)
Greenwich apparent sidereal time
-
gdate (jdate)
convert Julian date to Gregorian (calendar) date
-
geodet1 (rmag, dec)
geodetic latitude and altitude
-
getdate
interactive request and input of calendar date
-
getoe(ioev)
interactive request of classical orbital elements
-
gettime
interactive request and input of universal time
-
gravity (t, y)
first order equations of orbital motion
-
jd2str(jdate)
convert Julian date to string equivalent
-
julian (month, day, year)
Julian date
-
moon (jdate)
lunar ephemeris
-
oeprint1(mu, oev)
print six classical orbital elements
-
om_constants
astrodynamic and utility constants
-
orb2eci(mu, oev)
convert classical orbital elements to eci state vector
-
r2r (x)
revolutions to radians function
-
readgm(fname)
read gravity model data file
-
readoe1(filename)
read orbital elements data file
-
rkf78 (deq, neq, ti, tf, h, t...
solve first order system of differential equations
-
sun1 (jdate)
solar ephemeris
-
svprint(r, v)
print position and velocity vectors and magnitudes
-
gto.m
-
View all files
from
The Long-term Evolution of Geosynchronous Transfer Orbits
by David Eagle
Interactive MATLAB script that predicts the long-term evolution of geosynchronous transfer orbits.
|
| ceqm1 (t, y)
|
function ydot = ceqm1 (t, y)
% first order form of Cowell's equations of orbital motion
% includes perturbations due to:
% non-spherical earth gravity
% point mass sun and moon gravity
% input
% t = current simulation time (seconds)
% y = current eci state vector (km and km/sec)
% output
% ydot = eci acceleration vector (km/sec^2)
% Orbital Mechanics with MATLAB
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global isun imoon jdate0 smu mmu
agrav = zeros(3, 1);
asun = zeros(3, 1);
amoon = zeros(3, 1);
ydot = zeros(1, 6);
% compute geopotential perturbation
agrav = gravity(t, y);
if (isun == 1)
% solar perturbations
jdate = jdate0 + t / 86400;
[rasc, decl, rsun] = sun1(jdate);
% compute heliocentric position vector of the spacecraft
for i = 1:3
rs2sc(i) = y(i) - rsun(i);
end
% f(q) formulation
for i = 1:1:3
vtmp(i) = y(i) - 2.0d0 * rsun(i);
end
dot1 = dot(y(1:3), vtmp);
dot2 = dot(rsun, rsun);
qsun = dot1 / dot2;
fsun = qsun * ((3.0d0 + 3.0d0 * qsun + qsun * qsun) ...
/ (1.0d0 + (1.0d0 + qsun)^1.5d0));
d3sun = norm(rs2sc)^3;
% point-mass gravity of the sun
for i = 1:1:3
asun(i) = -smu * (y(i) + fsun * rsun(i)) / d3sun;
end
end
if (imoon == 1)
% lunar perturbations
jdate = jdate0 + t / 86400;
[rasc, decl, rmoon] = moon(jdate);
% compute selenocentric position vector of the spacecraft
for i = 1:1:3
rm2sc(i) = y(i) - rmoon(i);
end
% f(q) formulation
for i = 1:1:3
vtmp(i) = y(i) - 2.0d0 * rmoon(i);
end
dot1 = dot(y(1:3), vtmp);
dot2 = dot(rmoon, rmoon);
qmoon = dot1 / dot2;
fmoon = qmoon * ((3.0d0 + 3.0d0 * qmoon + qmoon * qmoon) ...
/ (1.0d0 + (1.0d0 + qmoon)^1.5d0));
d3moon = norm(rm2sc)^3;
% point-mass gravity of the moon
for i = 1:1:3
amoon(i) = -mmu * (y(i) + fmoon * rmoon(i)) / d3moon;
end
end
% total acceleration vector
ydot(1) = y(4);
ydot(2) = y(5);
ydot(3) = y(6);
for i = 1:1:3
ydot(i + 3) = agrav(i) + asun(i) + amoon(i);
end
|
|
Contact us