[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #38063] optim: expfit inaccurate (incorrect)
From: |
Muhali |
Subject: |
[Octave-bug-tracker] [bug #38063] optim: expfit inaccurate (incorrect) |
Date: |
Fri, 11 Jan 2013 14:15:27 +0000 |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:17.0) Gecko/20100101 Firefox/17.0 |
URL:
<http://savannah.gnu.org/bugs/?38063>
Summary: optim: expfit inaccurate (incorrect)
Project: GNU Octave
Submitted by: muhali
Submitted on: Fri 11 Jan 2013 06:15:26 AM PST
Category: Octave Forge Package
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Inaccurate Result
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: Any
_______________________________________________________
Details:
I get very bad results from the expfit estimator for exp fitting. The function
has a demo that uses *extremely* low levels of noise. With more realistic
levels the fit becomes useless. In this example
pkg load optim
## expfit
x0 = 0; step = 0.05; xend = 5; x = x0:step:xend;
y = 2*exp(1.3*x)-0.5*exp(2*x);
error = (rand(1,length(y))-0.5)*3e3;
[alpha,c,rms] = expfit(1,x0,step,y+error);
## nonlin_curvefit
fun = @(p,x) p(2)*exp(p(1)*x) ; p0 = [1;-1] ;
[p, fy, cvg, outp] = nonlin_curvefit(fun, p0, x, y+error)
hold on
plot(x, y=y+error, "k.")
plot(x, c*exp(alpha*x), "r-;expfit;")
plot(x, fy, "b-;nonlin_curvefit;")
legend("location", "southwest")
print foo.png
expfit is compared with a more conventional iterative technique, showing the
discrepancies (see attached figure; the demo noise level had to be expanded by
7(!) orders of magnitude).
Apparently expfit is based on Prony's method, a DSP technique similar to
Fourier analysis. Either that method cannot be used for fitting noisy data, or
its implementation in expfit is incorrect. In either case I consider the
expfit function buggy, and recommend not using it.
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Fri 11 Jan 2013 06:15:26 AM PST Name: foo.png Size: 46kB By: muhali
<http://savannah.gnu.org/bugs/download.php?file_id=27243>
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?38063>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Octave-bug-tracker] [bug #38063] optim: expfit inaccurate (incorrect),
Muhali <=