From: Greg Heath on 7 Jul 2010 21:10 On Jul 7, 4:41 am, "Jan Simon" <matlab.THIS_Y...(a)nMINUSsimon.de> wrote: > Dear Cesare, > > > I don't know if this is related, however I've noticed that for > > x = start:step:stop; > > d = x(2:end) - x(1:end-1); > > e = eps(d); > > then unique(e) is tipically (well at least for my random tests) a scalar. I was wondering whether an observation like this or some other idea could be used to set the smallest possible threshold for determining whether x could be of the form start:step:stop. > > The method used in INTERP1, Matlab 6.5, to determine equally spaced input: > eqsp = (norm(diff(x), Inf) < eps*norm(x, Inf)); > Matlab 2009a: > h = diff(x); > eqsp = (norm(diff(h), Inf) <= eps(norm(x, Inf))); > if any(~isfinit(x)), eqsp = 0; end > ??? Is it correct to check the norm of DIFF(h) instead of DIFF(x) ??? Of course. A straight line is the only curve with a constant zero 2nd derivative. Greg
From: Jan Simon on 8 Jul 2010 03:39 Dear Greg, > > The method used in INTERP1, Matlab 6.5, to determine equally spaced input: > > eqsp = (norm(diff(x), Inf) < eps*norm(x, Inf)); > > Matlab 2009a: > > h = diff(x); > > eqsp = (norm(diff(h), Inf) <= eps(norm(x, Inf))); > > ??? Is it correct to check the norm of DIFF(h) instead of DIFF(x) ??? > Of course. A straight line is the only curve > with a constant zero 2nd derivative. Mathematically. With floating point arithmetics the problem is to determine the almost constant 2nd difference quotients. For this task I expected something like: all(abs(diff(x)) < eps(x)) % *Invalid*, DIFF(x) is shorter e.g. to catch [1:1e7:1e14], [1+1e-5, 1e7:1e7:1e14] and [1e14 + (1:0.00001:2)]. The Inf-norm is not really helpful here and the the accuracy of the 2nd difference quotient is not directly related to the accuracy of the single steps. Do I miss the important idea behind the Inf-norm here? The problem is to distiunguish noisy steps (not equidistant) from noise caused by the limited floating point precision. Kind regards, Jan
First
|
Prev
|
Pages: 1 2 3 4 Prev: Changing the save button in figure windows Next: Tracing xPC execution times |