%% jdate.m calculates the Julian Date for the given day
%% of interest, as well as the number of days that have
%% passed since 12UT, 1 Jan 2000. The equations used are
%% from the Satellite Times articles by Dr T.S.Kelso.

function [jd,dp2000]=jdate(day,month,year)

% day = day array
% month = month array
% year = years array
% 
% jd = Julian Date
% dp2000 = days pasted since 12UT, 1 Jan 2000.

%Calculate the Julian date of January 0.0 for year
yeari=year-1;
a=floor(yeari/100);
b=2-a+floor(a/4);
jdy=floor(365.25*yeari)+floor(30.6001*14)+1720994.5+b;

%Calculate the Julian date
jd=jdy+daynum(day,month,year);
dp2000=jd-2451545.0;
