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.

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

% areocentric distance 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 distance difference (au)

% Orbital Mechanics with MATLAB

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

global aunit jdtdb_wrk rmag_user

% compute mars heliocentric state vector at current time t

jdate = jdtdb_wrk + t;

svmars = jplephem (jdate, 4, 11);

rmars = svmars(1:3);

% form the mars-centered spacecraft position vector

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

% areocentric distance

value = norm(rm2sc) - rmag_user / aunit;

isterminal = 1;

direction =  [];



Contact us