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

rsprint(iflag, jdutc)
function rsprint(iflag, jdutc)

% print visibility conditions 

% required by riseset.m

% Celestial Computing with MATLAB

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

global azimuth elevation jdsaved

% convert julian day to calendar date
% and universal time strings

[cdstr, utstr] = jd2str(jdutc);

if (iflag == 1)
    
   fprintf('\n\nrise conditions');
   fprintf('\n---------------\n\n');
   
   jdsaved = jdutc;
   
end

if (iflag == 2)
    
   fprintf('\nmaximum elevation conditions');
   fprintf('\n----------------------------\n\n');
   
end

if (iflag == 3)
    
   fprintf('\nset conditions');
   fprintf('\n--------------\n\n');
   
end

fprintf('calendar date        ');

disp(cdstr);

fprintf('\nuniversal time       ');

disp(utstr);

fprintf('\n');

fprintf('UTC Julian date      %10.4f \n\n', jdutc);

% display topocentric angles and slant range

[d, m, s, azimstr] = deg2dms (azimuth);

[d, m, s, elevstr] = deg2dms (elevation);

fprintf('topocentric azimuth angle    ');

disp(azimstr);

fprintf('\ntopocentric elevation angle  ');

disp(elevstr);

% determine event duration

if (iflag == 3)
    
   deltat = 24 * (jdutc - jdsaved);
   
   [h, m, s, hmsstr] = hrs2hms (deltat);
   
   fprintf('\n\ncelestial event duration     ');
   
   disp(hmsstr);
   
end


Contact us