Code covered by the BSD License  

Highlights from
A MATLAB Script for Propagating Interplanetary Trajectories from Earth to Mars

A MATLAB Script for Propagating Interplanetary Trajectories from Earth to Mars

by

 

Numerically integrate the orbital equations of motion of an Earth to Mars interplanetary trajectory.

fpa_event(t, y)
function [value, isterminal, direction] = fpa_event(t, y)

% areocentric flight path angle event function

% required by pprop_e2m.m

% input

%  t = time since "working" tdb julian date (days)
%  y = spacecraft heliocentric state vector (au, au/day)

% output

%  value = areocentric flight path angle (radians)

% Orbital Mechanics with MATLAB

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

global jdtdb_wrk

% compute mars heliocentric state vector at current time t

jdate = jdtdb_wrk + t;

svmars = jplephem (jdate, 4, 11);

rmars = svmars(1:3);

vmars = svmars(4:6);

% form the mars-centered spacecraft position and velocity vectors

rm2sc = y(1:3) - rmars(1:3);

vm2sc = y(4:6) - vmars(1:3);

tmatrix = mme2000(jdate);

rsc = tmatrix * rm2sc;

vsc = tmatrix * vm2sc;

% flight path angle

fpa = asin(rsc' * vsc / (norm(rsc) * norm(vsc)));

value = fpa;

isterminal = 1;

direction =  [];



Contact us