Code covered by the BSD License  

Highlights from
Closest Approach Between the Earth and Heliocentric Objects

Closest Approach Between the Earth and Heliocentric Objects

by

 

06 Dec 2012 (Updated )

MATLAB script that predicts closest approach between the Earth and heliocentric objects.

uvector(x)
function vhat = uvector(x)

% unit vector

% input

%  x = 3-component input vector

% output

%  vhat = 3-component unit vector

% Celestial Computing with MATLAB

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

vmag = sqrt(dot(x, x));

if (vmag > 0)
   vhat = x / vmag;
else
   vhat = 1.0e99;
end

Contact us