help-octave
[Top][All Lists]
Advanced

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

Re: Curve fit


From: Liam Groener
Subject: Re: Curve fit
Date: Mon, 22 Nov 2010 11:47:21 -0800


On Nov 22, 2010, at 6:34 AM, Martin Maxino wrote:


Hi,

Liam, i need help again.

I want to curve fit a set of data points using an exponential decay
function.

Suppose its a decay curve of sound.

Could you please illustrate it for me how to do it?

I don't know if this function would work: f(x) = f_0*e^(-xt), where f_0 is
the initial value of f(x) at t=0;
Hi,
While the answers you got from James are correct, you could use the non-linear curve fit instead:

  [c,fval,info,output]=fsolve(@(c)(c(1)*exp(-c(2)*t)-x),[10;.1]);

You don't really need to use .* in this case since the multiplications are between a vector and a scaler, not between two vectors. (In my emails to Cunninghands, I did put dots a couple of places where they were not really necessary. Sorry about that.)

Whether you make the pre-exponential factor an unknown parameter (as in the example above) or a known constant depends on what you know for a fact. If you know the actual initial condition (as opposed to measuring it), just fit for one unknown parameter. In the example above, in the first guess for the parameters, [10;.1], you could use a measured value for c(1) in place of the 10.




reply via email to

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