Home > matutils > mosaic > dtor.m

dtor

PURPOSE ^

function rad=dtor(hours)

SYNOPSIS ^

function rad=dtor(degrees)

DESCRIPTION ^

 function rad=dtor(hours)

 Convert from degrees to radians. 

 Inputs:

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

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