No BSD License  

Highlights from
Skyplot1001

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

[x,y,z,vx,vy,vz]=posvel(l,b,r,dl,db,dr)
function [x,y,z,vx,vy,vz]=posvel(l,b,r,dl,db,dr)

% function [x,y,z,vx,vy,vz]=posvel(l,b,r,dl,db,dr)
%
% cartesian position and velocity
% from polar coordinates and polar velocity
% algorithms by Montenbruck/Pfleger: "Astronomy with the Personal Computer"
%
% 05.05.04 M.Penzkofer

rho = pi/180;

CL = cos(l*rho);
SL = sin(l*rho);
CB = cos(b*rho);
SB = sin(b*rho);

x = r*CL*CB;  vx = dr*CL*CB-dl*r*SL*CB-db*r*CL*SB;
y = r*SL*CB;  vy = dr*SL*CB+dl*r*CL*CB-db*r*SL*SB;
z = r*SB;     vz = dr*SB              +db*r*CB;

Contact us at files@mathworks.com