Code covered by the BSD License
 cgl(np, a, b)
computes nodes and weights of the
 defect_trap(tk, tkp1, xk,...state vector defects  trapezoid method
 dto_guess(ti, tf, xi, xf,...compute linear guess
 dto_rhs (t, x, u)
firstorder equations of motion
 dtofunc_trap (x)
objective function and equality constraints
 dto_trap.m

View all files
Aerospace Trajectory Optimization Using Direct Transcription and Collocation
by
David Eagle
06 Nov 2012
(Updated
09 Sep 2013)
Demonstrates the solution of an aerospace trajectory optimization problem.

dto_rhs (t, x, u)

function xdot = dto_rhs (t, x, u)
% firstorder equations of motion
% required by dto_trap.m
% input
% t = current time
% x = current state vector
% x(1) = r, x(2) = u, x(3) = v
% u = current control vector
% output
% xdot = rhs equations of motion
% xdot(1) = r dot, xdot(2) = u dot, xdot(3) = v dot
% Orbital Mechanics with MATLAB
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global acc beta
% current control variable
theta = u(1);
% current thrust acceleration
accm = acc / (1.0  beta * t);
% evaluate equations of motion at current conditions
xdot(1) = x(2);
xdot(2) = (x(3) * x(3)  1.0 / x(1)) / x(1) + accm * sin(theta);
xdot(3) = x(2) * x(3) / x(1) + accm * cos(theta);


Contact us