Code covered by the BSD License
- [fid, mu, req, oev1, oev2...read orbital elements and simulation
- atan3 (a, b)
four quadrant inverse tangent
- brent (f, x1, x2, rtol)
solve for a single real root of a nonlinear equation
- eci2lvlh (r, v, upeci)
convert eci unit pointing vector to local
- eci2orb1 (mu, r, v)
convert eci state vector to six classical orbital
- make_textfile(soln)
create disk text files of solutions
- oeprint1(mu, oev)
print six classical orbital elements
- oeprint2(fid, mu, oev)
print six classical orbital elements
- om_constants
astrodynamic and utility constants
- oota_iniz
initialization routine
- ootafun1 (x)
delta-v objective function
- ootafun2 (x)
transfer orbit semiparameter objective function
- orb2eci(mu, oev)
convert classical orbital elements to eci state vector
- pgraphics(soln, x1, y1, y2)
create disk file of primer graphics
- primer(dtof, rt1eci, vt1e...examine primer vector and its derivative for optimality
- pvdot(x)
primer derivative
- pvector (ri, vi, x)
primer vector and derivative magnitudes
- pviniz (tof, r1, v1, dv1,...primer vector initialization
- stm2 (mu, tau, ri, vi)
two body state transition matrix
- svprint(r, v)
print position and velocity vectors and magnitudes
- svprint1(fid, r, v)
print position and velocity vectors and magnitudes to file
- tgraphics(soln, dtof)
create disk file of trajectory graphics
- tof1(mu, sma, ecc, tanom1...time of flight between two true anomalies
- twobody2 (mu, tau, ri, vi)solve the two body initial value problem
- uvector(x)
unit vector
- oota_matlab.m
-
View all files
from
Optimal Impulsive Orbital Transfer
by David Eagle
MATLAB script for the solution of the one and two impulse orbit transfer between two Earth orbits.
|
| 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