Closed RibomBalt closed 3 years ago
Dear @RibomBalt, thank you for reporting this issue.
I have just made a commit in the devel branch of irfu-matlab which should hopefully help in fixing this issue (this commit will be merged into the master branch and included in the next release).
The problem is down to the floating-point accuracy of the parameters dy
and dy10power
, they should in your first example both have a value of exactly 0.1
but they are ever so slightly different due to how the values are stored binary. We have the dy
being somewhat smaller than dy10power
:
K>> dy-dy10power
ans =
-2.775557561562891e-17
This is within "eps()", https://se.mathworks.com/help/matlab/ref/eps.html, however it means that when we divide one by the other we get something like 0.999999...
which when floor'ed goes to all the way to zero.
With best regards,
Thomas Nilsson
Step 1: Latest code?
git pull
this is still a problem).Step 2: Describe your environment
Step 3: Describe the problem
With certain input,
irf_plot
fails to plot a figure and cast an error like this: (with original output translated to English)Relevant code:
The code reproducing this error can be very simple. Any of the following lines could reproduce this problem.
After debugging, I guess this may be related to some floating-point arithmetic error stuff.
irf_plot
seems to automatically callirf_zoom
to adjust the y-axis. During this process, when it reaches the following parts ofirf_zoom.m
:dy1stcipher
becomes zero, which is unexpected becausedy
anddy10power
are equal in those 3 cases and this should return 1.