Error compounds adding date numbers

조회 수: 1 (최근 30일)
Abdul
Abdul 2012년 7월 16일
Hi, I am adding two date numbers. Upon multiple iterations the error in the addition seems to compound. For example if I add 10 seconds in date number the result seems to drop a few milliseconds every few iterations. Does anybody know the reason for that or a fix? P.S. I am using datenum function to generate date numbers.
  댓글 수: 1
Sean de Wolski
Sean de Wolski 2012년 7월 16일
Can you give us a small example of what you're doing?

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

답변 (1개)

C.J. Harris
C.J. Harris 2012년 7월 16일
If you are using MATLAB date numbers they are stored as double precision numbers. This means the resolution of the date numbers are:
eps(now) * 84600 = 1.00582838058472e-005 (s)
As you can see this is roughly 0.01 milliseconds. Therefore rounding errors and so forth are very likely to result in you dropping (or adding) milliseconds here and there over many iterations (containing mathematical manipulations).

카테고리

Help CenterFile Exchange에서 Time Series Objects에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by