필터 지우기
필터 지우기

Add n days to juliandate

조회 수: 2 (최근 30일)
Asatur Khurshudyan
Asatur Khurshudyan 2020년 1월 23일
댓글: Asatur Khurshudyan 2020년 1월 23일
Hello everyone!
I am using
planetEphemeris(juliandate(y, m, d), 'Sun', 'Mars')
to extract the position of Mars relative to Sun at a given date
y, m, d.
Now, I need to add a specific number of days to that date and extract the position of the new date. Apparently,
planetEphemeris(juliandate(y, m, d) + n, 'Sun', 'Mars')
does not work. What do I need to add instead of n to have the position of Mars in, say, 100 days after that date?
Thank you in advance.

채택된 답변

Robert U
Robert U 2020년 1월 23일
Hi Asatur Khurshdyan,
According to documentation example juliandate() you may use caldays() to add calendar days to a datetime-date.
planetEphemeris(juliandate(datetime(y,m,d)+caldays(n)), 'Sun', 'Mars')
Kind regards,
Robert
  댓글 수: 1
Asatur Khurshudyan
Asatur Khurshudyan 2020년 1월 23일
Dear Robert,
Thank you for your answer. Sorry about missing that part from documentation.
Best,
Asatur

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Bjorn Gustavsson
Bjorn Gustavsson 2020년 1월 23일
It seems to work just fine as far as I can see. When I compare:
jd0 = juliandate(2020, 2, 14);
jd0p100 =juliandate(2020, 2, 14) + 100;
jd0p101 =juliandate(2020, 2, 14 + 100);
isequal(jd0p100,jd0p101) % returns true
jd0p101 - jd0 % returns 100
everything seems OK.
What is your problem? What matlab-version are you using?
HTH

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by