Code covered by the BSD License  

Highlights from
Rise and Set of the Sun, Moon and Planets

Rise and Set of the Sun, Moon and Planets

by

 

05 Dec 2012 (Updated )

Topocentric rise and set of the Sun, Moon and planets. Source ephemeris is DE421 with NOVAS routines

jd2str(jdate)
function [cdstr, utstr] = jd2str(jdate)

% convert Julian date to string equivalent
% calendar date and universal time

% input

%  jdate = Julian date

% output

%  cdstr = calendar date string
%  utstr = universal time string

% Celestial Computing with MATLAB

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

[month, day, year] = gdate(jdate);

% serial date number

sdn = datenum(year, month, day);

% create calendar date string

cdstr = datestr(sdn, 1);

% create universal time string

utstr = datestr(day - fix(day), 13);

Contact us