MATLAB Answers

time increment and julian date

7 views (last 30 days)
Hello everyone,
Here is my problem:
First I have a departure date:
date_ = ( 2011 08 18) % initialize
Let's say I have a loop as well, and within this loop I need to convert from calendar date to Julian date since I am using this information later to determine the geocentric position of the Sun rsun_.
For t = 0 : 30 min : 200 days % 200 days is the simulation time
date_ = date_ + t_; % how to add 30 minutes for each iteration and
keeping format (YYYY MM DD) for conversion to
Julian date
date__ = julian( date_ );
rsun_ = ephemeris_sun( date__ );
% after I can perform my calculations
My problem is: look comment in the loop.
Thanks a lot,
Rom

  0 Comments

Sign in to comment.

Accepted Answer

Laura Proctor
Laura Proctor on 7 Jul 2011
Create the initial date as a 1x6 vector:
od = [ 2011 08 18 0 0 0 ];
Then, to add 30 minutes at each iteration, add 30 to the fifth element:
od(5) = od(5) + 30;
now you can use juliandate to convert the information to a Julian date:
jd = juliandate(od);

  1 Comment

James Tursa
James Tursa on 9 Jul 2011
Side Note: That only works if od is in Ephemeris Time. If od is in UT then it doesn't account for leap seconds. If od is not in UT then it won't account for time zone differences. Don't use this method for precision work.

Sign in to comment.

More Answers (1)

James Tursa
James Tursa on 7 Jul 2011
Caution: To be precise, a sun position algorithm will need a Julian Date based on Ephemeris Time. So you would need to convert the date vector from whatever time convention it is in (e.g., your local time, or UT, or whatever) to an Ephemeris Time before doing the Julian Date conversion. Basically, planetary calculations need a continuous time to work with, and local times, UT, etc do not meet that requirement. What time convention is your date vector in?

  0 Comments

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!