Code covered by the BSD License
-
atan3 (a, b)
four quadrant inverse tangent
-
brent (f, x1, x2, rtol)
solve for a single real root of a nonlinear equation
-
coe2eqoe(coe)
convert classical orbital elements to
-
coe2mee(mu, coe)
convert classical orbital elements to modified equinoctial orbital elements
-
ecf2eci (gast, recf, vecf)
ecf-to-eci transformation
-
eci2ecf (gast, reci, veci)
eci-to-ecf transformation
-
eci2fpc1(gast, reci, veci)
convert inertial state vector to flight path coordinates
-
eci2mee(mu, reci, veci)
convert eci state vector to
-
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
-
eqxra (tjd, k)
this function computes the intermediate right ascension
-
erot (date1, date2)
this function returns the value of the earth rotation angle
-
etilt1 (tjd)
this function computes quantities related to the orientation
-
findleap(jdate)
find number of leap seconds for utc julian date
-
fpc2ecf (fpc)
transform relative flight path coordinates
-
fpc2eci(gst, fpc)
convert relative flight path coordinates to inertial state vector
-
funarg (t)
this function computes fundamental arguments (mean elements)
-
gast2 (tjdh, tjdl, k)
this function computes the greenwich sidereal time
-
gast4 (tjdh, tjdl, k)
this function computes the greenwich sidereal time
-
gdate (jdate)
convert Julian date to Gregorian (calendar) date
-
geodet1 (rmag, dec)
geodetic latitude and altitude
-
geodet4 (lat, alt)
geodetic to geocentric coordinates
-
get_tdb_time
interactive request and input of Barycentric Dynamical Time
-
get_utc_time
interactive request and input of universal coordinated time
-
getdate
interactive request and input of calendar date
-
getoe(ioev)
interactive request of classical orbital elements
-
getsv
interactive request of state vector
-
gettime
interactive request and input of universal time
-
hrs2hms (hrs)
convert decimal hours to hours,
-
jd2str(jdate)
convert Julian date to string equivalent
-
jdfunction (jdin)
objective function for tdb2utc
-
julian (month, day, year)
Julian date
-
kepler1 (manom, ecc)
solve Kepler's equation for circular,
-
lla2eci (gast, lat, long, alt...
convert geodetic altitude, latitude and longitude to eci position vector
-
mee2coe(mee)
convert modified equinoctial elements to classical orbit elements
-
nod(jdate)
this function evaluates the nutation series and returns the
-
nut2000b (jdate)
nutation based on iau 2000b theory
-
obliq(t)
function to compute mean obliquity of the ecliptic in arcseconds
-
oeprint1(mu, oev, ittype)
print six classical orbital elements
-
oeprint3(mu, oev, ittype)
print complete set of orbital elements
-
om_constants
astrodynamic and utility constants
-
orb2eci(mu, oev)
convert classical orbital elements to eci state vector
-
orb2hyper(oev)
this function converts classical orbital elements
-
osc2mean (oeosc)
convert osculating classical orbital elements
-
read_rv2tle(filename)
read rv2tle data file
-
readfpc1(filename)
read flight path coordinates data file
-
readgeo1(filename)
read geodetic coordinates data file
-
readleap
read leap seconds data file
-
readmee1(filename)
read modified equinoctial orbital elements data file
-
readoe1(filename)
read classical orbital elements data file
-
readsv1(filename)
read eci state vector data file
-
rv2fpc (r, v)
transform from cartesian coordinates
-
rv2hyper (mu, rsc, vsc)
convert position and velocity vectors to
-
rv2tle(reci, veci)
convert osculating position and velocity vectors
-
svprint(r, v)
print position and velocity vectors and magnitudes
-
tdb2utc (jdtdb)
convert TDB julian date to UTC julian date
-
times_novas (tdbjd)
this function computes the terrestrial time (tt) julian date
-
utc2tdb (jdutc)
convert UTC julian date to TDB julian date
-
utc2tt (jdutc)
convert UTC julian date to TT julian date
-
csystems.m
-
elong2ra.m
-
View all files
from
A MATLAB Script for Time and Coordinate Calculations
by David Eagle
Interactive MATLAB script that can be used to perform time and coordinate calculations.
|
| brent (f, x1, x2, rtol)
|
function [xroot, froot] = brent (f, x1, x2, rtol)
% solve for a single real root of a nonlinear equation
% Brent's method
% input
% f = objective function coded as y = f(x)
% x1 = lower bound of search interval
% x2 = upper bound of search interval
% rtol = algorithm convergence criterion
% output
% xroot = real root of f(x) = 0
% froot = function value at f(x) = 0
% Orbital Mechanics with MATLAB
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global iter;
% machine epsilon
eps = 2.23e-16;
e = 0;
a = x1;
b = x2;
fa = feval(f, a);
fb = feval(f, b);
fc = fb;
for iter = 1:1:50
if (fb * fc > 0)
c = a;
fc = fa;
d = b - a;
e = d;
end
if (abs(fc) < abs(fb))
a = b;
b = c;
c = a;
fa = fb;
fb = fc;
fc = fa;
end
tol1 = 2 * eps * abs(b) + 0.5 * rtol;
xm = 0.5 * (c - b);
if (abs(xm) <= tol1 || fb == 0)
break;
end
if (abs(e) >= tol1 && abs(fa) > abs(fb))
s = fb / fa;
if (a == c)
p = 2 * xm * s;
q = 1 - s;
else
q = fa / fc;
r = fb / fc;
p = s * (2 * xm * q * (q - r) - (b - a) * (r - 1));
q = (q - 1) * (r - 1) * (s - 1);
end
if (p > 0)
q = -q;
end
p = abs(p);
min = abs(e * q);
tmp = 3 * xm * q - abs(tol1 * q);
if (min < tmp)
min = tmp;
end
if (2 * p < min)
e = d;
d = p / q;
else
d = xm;
e = d;
end
else
d = xm;
e = d;
end
a = b;
fa = fb;
if (abs(d) > tol1)
b = b + d;
else
b = b + sign(xm) * tol1;
end
fb = feval(f, b);
end
xroot = b;
froot = fb;
|
|
Contact us