Menu

#546 Floating point accuracy errors in graphs

v4.1 (minor)
open
nobody
5
2012-03-11
2012-03-11
No

I have experience errors when graphing values where the points are plotted in the wrong location. It seems to be caused by floating point inaccuracy when the data is transferred to the graph (this data is automatically generated as the time in milliseconds since 1970).

For example, if I have the data:

test = [1.33098888328525 1.33098888331650];

Then Freemat is happy to store it accurately:

format long
test

However, when I try to plot it then it seems to reduce the resolution / accuracy of the number:

plot(test)

I would expect the behaviour to be the same as values with no accuracy issues, such as this:

test2 = [ 1 2];
plot(test2)

I can work around this for now by making the value relative to the first value that I am trying to plot, for example using:

plot(test - test(1))

but this is not ideal.

Discussion


Log in to post a comment.