help-octave
[Top][All Lists]
Advanced

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

Re: exponential fitting


From: Gert Van den Eynde
Subject: Re: exponential fitting
Date: Thu, 5 Sep 2002 16:40:23 +0200

> 
> > expfit will return a term where b = 0 and a is the constant 'c' you're 
> > looking for (exp(0*x) = 1).
> 
> Sorry, I don't understand what you've written. AFAIK expfit uses y=a*exp(b*x) 
> fitting the data and returns three values: a, b, and the rms. Actually I 
> don't need the value of 'c', but to get the right 'b' I have to fit it with 
> y=a*exp(b*x)+c. That's the problem. 

No. expfit fits to y = \sum_{i=1}^N a_i * \exp(b_i *x) (if you read TeX). In 
words: it fits a sum of exponentials and returns vectors a_i, b_i. You have to 
provide the number of terms as input to the function (see 'help expfit'). If 
you want to fit y = a*exp(b*x)+c, set N to 2. You will get two vectors as 
result and one element of the b-vector should be around zero. There is an 
example in the file expfit.m

> 
> And there is another problem: the fit is really bad. 

Exponential fitting is *really* (*really*!) badly conditioned. You need lots of 
data to get a reasonable result. But of course, your bad results could come 
from the fact that you gave the wrong N (number of terms) as input (to cope 
with the constant c).

> Fitting the same data with expfit and leasqr, I get:
> 
> fit-function: y=a*exp(b*x)+1  
> expfit: y=9.7*exp(-0.0029*x)+1   R^2=54.8
> leasqr: y=9.5*exp(-0.0018*x)+1   R^2=97
> 
> I used a konstant c=1, otherwise I can't compare the results.
> 
> But expfit seems to be very stable and easy to use, while leasqr is very 
> sensitive to the starting values.

expfit transforms the optimisation process of a least-squares fit to a search 
for roots of a polynomial. This only works for this kind of problem 
(exponential fit with *equidistant* data). 


Good luck,

Gert



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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