help-octave
[Top][All Lists]
Advanced

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

Re: i just want to use nonlinear curve fitting function , what should i


From: Tatsuro MATSUOKA
Subject: Re: i just want to use nonlinear curve fitting function , what should i do?
Date: Mon, 18 Jan 2010 17:19:08 +0900 (JST)

Hello

--- Jaroslav Hajek wrote:

> No, that is not necessary. Nonlinear curve fitting is just solving an
> overdetermined system of nonlinear equations (i.e. more equations than
> variables), and that's all - you make a function that calculates the
> equation residuals and feed it to fsolve. You can, optionally, also
> compute the Jacobian (a rectangular matrix, in this case), if you can
> do it more efficiently than via finite differences.
> The system is solved for in a least squares sense. It's analogous to
> how the \ operator works.
> 
> Here's an example fitting the model y = exp(a*x) + b to an
> artificially created dataset:
> 
> b0 = 3;
> a0 = 0.2;
> x = 0:.5:5;
> noise = 1e-5 * sin (100*x);
> y = exp (-a0*x) + b0 + noise;
> c_opt = [a0, b0];
> tol = 1e-5;
> 
> [c, fval, info, output] =  fsolve (@(c) (exp(-c(1)*x) + c(2) - y), [0, 0]);
> 
OK. Great!  Thanks!

Tatsuro

--------------------------------------
Get the new Internet Explorer 8 optimized for Yahoo! JAPAN
http://pr.mail.yahoo.co.jp/ie8/


reply via email to

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