generate timestamp in millisecond interval for interpolation

how to generate timestamp 0.250 seconds (4Hz) sampling interval? I tried [firstdatenum:0.125/86400:enddatenum]', but it gave me four different intervals (using diff) in the order 10^-6 (it is very small indeed, but annoying). I need the timestamp to interpolate it with other timeframe with 8Hz sampling interval.
If anyone can help. Thanks.

 Respuesta aceptada

Walter Roberson
Walter Roberson el 19 de Feb. de 2013
You are not going to be able to get exactly 0.25 second intervals in time stamps, as 86400 is not an exact divisor of 1.

3 comentarios

thanks. Just to make me clearer. Since the milliseconds is fraction of second in datenum, then none will be able to generate datenum with an exact milliseconds interval?
Jan
Jan el 19 de Feb. de 2013
@Erni: Yes, the double values replied by datenum cannot contain the milliseconds exactly due to the limited precision. The absolute value of the serial datenumbers deviate by -6.605e-011 and 5.036e-011 in my tests. This meets the possible resolution for doubles, when you consider the 6 leading digits.
The datevec format offers a higher resolution.
If the world happened to use a time scheme in which days were a power-of-two units long, and you were working with "mibiseconds" (1/1024 of the modified seconds), then you would be able to store them exactly.
The difficulty is not with "fractions of a second", the difficulty is that the fractions (of a day) do not have exact finite binary representations, just the same way that 1/3 does not have an exact finite decimal representation.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Preguntada:

el 19 de Feb. de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by