JULIAN converts Gregorian calendar dates to corresponding Julian day numbers. [j]=JULIAN(y,m,d,h) converts Gregorian calendar dates to corresponding Julian day numbers. Although the formal definition holds that Julian days start and end at noon, here Julian days start and end at midnight. In this convention, Julian day 2440000 began at 0000 Z, May 23, 1968. INPUT: d - day (1-31) component of Gregorian date m - month (1-12) component y - year (e.g., 1979) component h - decimal hours (assumed 0 if absent) OUTPUT: j - decimal Julian day number (e.g., 0000Z Jan 1 is 0.0) Usage: [j]=julian(y,m,d,h) or [j]=julian([y m d hour min sec]) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ver. 1: 5/15/91 (RS) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

- hms2h HMS2H hours, minutes, and seconds to decimal hours.

- greg2 GREG2 converts year day numbers to corresponding Gregorian calendar dates.

0001 function [j]=julian(y,m,d,h) 0002 0003 % JULIAN converts Gregorian calendar dates to corresponding Julian day numbers. 0004 % 0005 % [j]=JULIAN(y,m,d,h) converts Gregorian calendar dates to corresponding 0006 % Julian day numbers. Although the formal definition holds that Julian 0007 % days start and end at noon, here Julian days start and end at midnight. 0008 % In this convention, Julian day 2440000 began at 0000 Z, May 23, 1968. 0009 % 0010 % INPUT: d - day (1-31) component of Gregorian date 0011 % m - month (1-12) component 0012 % y - year (e.g., 1979) component 0013 % h - decimal hours (assumed 0 if absent) 0014 % 0015 % OUTPUT: j - decimal Julian day number (e.g., 0000Z Jan 1 is 0.0) 0016 % 0017 % Usage: [j]=julian(y,m,d,h) or [j]=julian([y m d hour min sec]) 0018 % 0019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0020 % ver. 1: 5/15/91 (RS) 0021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0022 0023 if nargin==3, 0024 h=0.; 0025 elseif nargin==1, 0026 h=hms2h(y(4),y(5),y(6)); 0027 d=y(3); 0028 m=y(2); 0029 y=y(1); 0030 end 0031 mo=m+9; 0032 yr=y-1; 0033 i=(m>2); 0034 mo(i)=m(i)-3; 0035 yr(i)=y(i); 0036 c = floor(yr/100); 0037 yr = yr - c*100; 0038 j = floor((146097*c)/4) + floor((1461*yr)/4) + ... 0039 floor((153*mo +2)/5) +d +1721119; 0040 0041 % If you want julian days to start and end at noon, 0042 % replace the following line with: 0043 % j=j+(h-12)/24; 0044 0045 j=j+h/24; 0046 end

Generated on Thu 01-Dec-2005 07:46:03 by