Home > atmlab > geographical > sun_celest.m

sun_celest

PURPOSE ^

SUN_CELEST Celestial coordinates of the Sun.

SYNOPSIS ^

function [ra,dec] = sun_celest(mjd)

DESCRIPTION ^

 SUN_CELEST Celestial coordinates of the Sun.
   [ra,dec] = sun_celest(mjd) calculates the Sun's Right Ascension and
   Declination at a given time, from the Astronomical Almanac (see
   Michalsky, 1988).  Both angles are given in radians.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

sun_celest.m

SOURCE CODE ^

0001 function [ra,dec] = sun_celest(mjd)
0002 % SUN_CELEST Celestial coordinates of the Sun.
0003 %   [ra,dec] = sun_celest(mjd) calculates the Sun's Right Ascension and
0004 %   Declination at a given time, from the Astronomical Almanac (see
0005 %   Michalsky, 1988).  Both angles are given in radians.
0006 
0007 %----------------------------------------------------------------
0008 % Craig Haley 20/09/01
0009 %   02-10-05 CSH vectorized
0010 %----------------------------------------------------------------
0011 
0012 DEGREE = pi/180.0;
0013 RADIAN = 180.0/pi;
0014 
0015 %get position of sun in ecliptic
0016 [L,ep,g] = sun_eclip(mjd);
0017 
0018 %right ascension in radians between 0 and 2*PI
0019 f = RADIAN;
0020 t = (tan(ep/2.0)).^2;
0021 ra = L*RADIAN-f.*t.*sin(2.0*L)+(f/2.0).*t.^2.*sin(4.0*L);
0022 ra = mod(ra,360.0);
0023 ra(ra < 0) = ra(ra < 0)+360;
0024 ra = ra*DEGREE;
0025 
0026 %calculate declination in radians
0027 dec = asin(sin(ep).*sin(L));

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005