octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #37410] image.m has a wrong check for linearly


From: Rik
Subject: [Octave-bug-tracker] [bug #37410] image.m has a wrong check for linearly-spaced x and y
Date: Mon, 14 Oct 2013 01:09:14 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:24.0) Gecko/20100101 Firefox/24.0

Update of bug #37410 (project octave):

                  Status:                    None => Fixed                  
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #6:

We don't necessarily need std(), but we would like something that is
dimensionless and the coefficient of variation was one such measure.

Consider the following example which has small, but non-linear, spacing and
would still pass your criterion.


tol = 10 * eps;
x = [1 1.5 3] * 1e-40;
dx = diff (x);
dx_maxmin = max (dx) - min(dx);
if (dx_maxmin > tol)
  disp ("non-linear");
else
  disp ("linear");
endif


which displays "linear".

I think this code should work which uses the percentage change (dimensionless)
from the mean delta.


tol = .01;  # 1% tolerance.  FIXME: this value was chosen without thought.
dx = diff (x);
dxmean = (max (x) - min (x)) / (numel (x) - 1);
dx = abs ((dx - dxmean) / dxmean);
dy = diff (y);
dymean = (max (y) - min (y)) / (numel (y) - 1);
dy = abs ((dy - dymean) / dymean);
if (any (dx > tol) || any (dy > tol))


I checked it in here
http://hg.savannah.gnu.org/hgweb/octave/rev/a433244dd697.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?37410>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]