Code covered by the BSD License  

Highlights from
Closest Approach Between the Earth and Heliocentric Objects

from Closest Approach Between the Earth and Heliocentric Objects by David Eagle
MATLAB script that predicts closest approach between the Earth and heliocentric objects.

cae2oprt(jdate)
function cae2oprt(jdate)

% print Earth-to-object closest approach conditions 

% required by cae2ho.m

% Orbital Mechanics with MATLAB

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

global aunit drsaved

% convert julian day to calendar date and time strings

[cdstr, utstr] = jd2str(jdate);

fprintf('\n\ntime and conditions at closest approach');
fprintf('\n=======================================\n\n');

fprintf('calendar date        ');

disp(cdstr);

fprintf('\nTDB time             ');

disp(utstr);

fprintf('\nTDB Julian date      %16.8f \n\n', jdate);

% display slant range

fprintf('geocentric distance  %16.8f  AU \n\n', drsaved);

fprintf('geocentric distance  %16.8f  km \n\n', aunit * drsaved);

Contact us