Code covered by the BSD License  

Highlights from
A MATLAB Script for Predicting Lunar Occultations

A MATLAB Script for Predicting Lunar Occultations

by

 

07 Dec 2012 (Updated )

Predict the local circumstances of lunar occultations of a planet or star.

hrs2hms (hrs)
function [h, m, s, hmsstr] = hrs2hms (hrs)

% convert decimal hours to hours,
% minutes, seconds and equivalent string

% Celestial Computing with MATLAB

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

if (hrs < 0)
   hrs = hrs + 24;
end

h = abs(hrs);
   
d = fix(h);
   
d1 = (h - d) * 60;
   
m = fix(d1);
   
s = (d1 - m) * 60;
    
hmsstr = sprintf('%+03d%s%02d%s%06.4f%s', d,...
            'h ', m, 'm ', s,'s');

 


Contact us