help-gsl
[Top][All Lists]
Advanced

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

Re: [Help-gsl] about nonlinear fit of several functions simultaneously


From: Francesco Abbate
Subject: Re: [Help-gsl] about nonlinear fit of several functions simultaneously
Date: Tue, 27 Jul 2010 13:26:20 +0200

2010/7/25 nim <address@hidden>:
> Hi,all
> I have datasets {f1, f2} over [X0,X1]. The task is to fit {f1,f2} 
> simultaneously by assuming two function F1(a,b) and F2(a,b) where {a,b} are 
> common parameters. How to realize this with the gsl Levenberg-Marquardt 
> solver? I have used it for a single dataset (i.e., only {f} over [X0,X1]}. 
> The solver seems to be designed for fitting only one function.
>
> I have an idea that a piecewise function can be defined and thus fitted 
> piecewisely. Is this right?
>
> Does anyone have any idea for dealing with this?
> Or can anyone recommend other library that can easily deal this situation?
> thanks in advance
> Liu

Hi,

I use GSL for the same kind of problem and the solution I've adopted
is what you describe as a "piecewise" function. So, to be more
precise, the first function f1 was sampled over N points and the same
for the function f2. I've therefore created a non-linear solver for
2*N data points and in the first N points I evaluate the function f1
while in the following N point I evaluate the function f2.

It does works perfectly and I believe it is correct also because the
GSL routine does not have the concept of an independent "x" variable
but it just require to have N values f_i for i that goes from 1 to N
and it does evaluate f_i versus y_i (or f_i versus 0). In this model
the i variable can cover the samples over a single continuous variable
"x" but you can also use it differently. You can actually have many
indipendent variables (a, b, c, d, ...) and the index "i" can span
just different observations for different values of the indipendent
variables. The GSL model for non-linear fit is therefore more general
that just the case y = f(x) and it can accomodate for other kind of
utilisation.

I hope that helps.

Best regards,
Francesco



reply via email to

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