I'm trying to timestamp samples at a 20MHz (50 ns period) using datenum, and subsequent timestamps all come out the same when I examine them with datevec (seconds column). Is this just a display issue or am I running up against the precision of datenum?
No products are associated with this question.
Well, let's find out.
Let's take a look at the precision of the time "now," converted to seconds
reference = now; precision = eps(reference); precision_seconds = precision*24*3600
Looks like about 10 us for an absolute timestamp.
If you want a relative timestamp with a max value of 1 day, we get the following:
reference = 1; precision = eps(reference); precision_seconds = precision*24*3600
Now we get a precision of about 0.02 ns.
The documentation of the datevec() function suggests to me that the precision is 1 millisecond.
A bit of playing around gives that this
>> datenum('01-00-0000 00:00:00.0001')
has a non-zero value, but this
>> datenum('01-00-0000 00:00:00.00001')
is zero, suggesting that maybe it is down around the 100 microseconds, but not 10 microseconds.