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