Precision Issue in adding very small fractions of seconds to datenum

1 vue (au cours des 30 derniers jours)
Amit
Amit le 6 Mai 2014
Commenté : Amit le 6 Mai 2014
Hello All:
I am trying to plot a .wav file audio signature with 'true time of recording' on the x-axis. My ideas was to use datenum, and the datetick to achieve this. But I ran into problems pretty early.
The file is coded at 14kHz, and is exactly 1 minute long. So audioread gives me 14000*60=840000 points. So the time 'relative to the wav file' runs from t=0 to t=60 seconds in steps of 1/14000 second.
I am then trying to use datenum to add 'true' time to the above. The actual time of recording is 05-March-2013 14:00:00 hrs. For simplicity, lets say it was 05-March-2013 00:00:00 hrs.
05-March-2013 00:00:00 is 735298. Call it 'a'. 1 second on top of this is 1/86400. The fraction of second I am dealing with is 1/14000. So fraction in 'datenum' terms is 1/14000/86400. Call it 'b'.
If I add 1/14000th of a second to the date, I already have 735298.0000000008267195767195768 which runs out of precision.
What can I do?
My ultimate aim is to achieve the audio signature of 'y' axis and 'actual date & time' on x-axis.
Thanks all for your attention. Any help will be highly appreciated.
  5 commentaires
James Tursa
James Tursa le 6 Mai 2014
Can you work with datevec formats instead?
Amit
Amit le 6 Mai 2014
Hello James:
Won't that amount to the same thing? Unless you mean that I somehow forget about the date-month-year and focus only on time of the day, as that's what I want to be shown on the xlabels.
Good idea to try. Though I am currently not sure how to do it. Thanks indeed. If you have some quick illustration for me, that'll be amazing.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Dates and Time dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by