No BSD License  

Highlights from
Skyplot1001

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

phi=atn2(y,x)
function phi=atn2(y,x)

% function phi=atn2(y,x)
%
% arcus Tangens from (y/x) for two arguments
% algorithms by Montenbruck/Pfleger: "Astronomy with the Personal Computer"
%
% 05.05.04 M.Penzkofer

rho = pi/180;

if (x == 0.0 & y == 0.0) 
	phi = 0.0;
else 
   AX=abs(x);
   AY=abs(y); 
   if (AX > AY) 
   	phi=atan(AY/AX)/rho;
   else
      phi=90.0-atan(AX/AY)/rho;
   end
   if (x < 0.0)
      phi=180.0-phi;
   end
   if (y < 0.0)
      phi=-phi;
   end
end

Contact us at files@mathworks.com