Precision Issue in adding very small fractions of seconds to datenum

조회 수: 1 (최근 30일)
Amit
Amit 2014년 5월 6일
댓글: Amit 2014년 5월 6일
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
James Tursa
James Tursa 2014년 5월 6일
Can you work with datevec formats instead?
Amit
Amit 2014년 5월 6일
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.

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

답변 (0개)

카테고리

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