No BSD License  

Highlights from
Skyplot1001

image thumbnail
from Skyplot1001 by Markus Penzkofer
Virtual Planetarium showing stars, the planets, the sun and the moon.

poswi=posang(x,y,z,dx,dy,dz)
function poswi=posang(x,y,z,dx,dy,dz)

% function poswi=posang(x,y,z,dx,dy,dz)
%
% position angle from given vectors
% algorithms by Montenbruck/Pfleger: "Astronomy with the Personal Computer"
%
% 05.05.04 M.Penzkofer

C = ( (-x*z)*dx + (-y*z)*dy + (x*x+y*y)*dz ) / sqrt(x*x+y*y+z*z);
S = ( (-y)*dx + (x)*dy );
PHI = atn2(S,C);
if (PHI < 0.0)
   poswi = PHI+360.0;
else
   poswi = PHI;
end

Contact us at files@mathworks.com