Home > matutils > mosaic > htor.m

htor

PURPOSE ^

function rad=htor(hours)

SYNOPSIS ^

function rad=htor(hours)

DESCRIPTION ^

 function rad=htor(hours)

 Convert from hours to radians. 

 Inputs:

   hours - An value, in hours. Can be a numeric or character array of
           the form hh:mm:ss.s

 Outputs:

   rad   - The corresponding value, in radians 

 (EML)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function rad=htor(hours)
0002 
0003 % function rad=htor(hours)
0004 %
0005 % Convert from hours to radians.
0006 %
0007 % Inputs:
0008 %
0009 %   hours - An value, in hours. Can be a numeric or character array of
0010 %           the form hh:mm:ss.s
0011 %
0012 % Outputs:
0013 %
0014 %   rad   - The corresponding value, in radians
0015 %
0016 % (EML)
0017 
0018 if(ischar(hours))
0019 
0020   [h,m,s] = strread(hours, '%d%d%f', 'delimiter', ':');
0021   neg = isneg(hours);
0022   
0023   if(neg)
0024     rad = -(-h + (m + s/60)/60) * pi/12;
0025   else
0026     rad =  ( h + (m + s/60)/60) * pi/12;
0027   end
0028 else
0029   rad = hours * pi/12;
0030 end
0031 
0032 rad = wrapRadians(rad);
0033 
0034 end

Generated on Sun 14-Jun-2015 17:12:45 by m2html © 2005