[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-gsl] Fitting biexponential decay
From: |
Totte Karlsson |
Subject: |
Re: [Help-gsl] Fitting biexponential decay |
Date: |
Tue, 12 Feb 2008 17:30:51 -0800 |
User-agent: |
Thunderbird 2.0.0.9 (Windows/20071031) |
Hi,
Thanks for your suggestions. I have not had time to really get started
on this until yesterday.
I'm not sure how to create a function of goodness of fit for my problem.
If that is simple I could use the multidimensional minimizer as you
suggested. However, maybe using least squares (the nonlinear least
squares fitting API) is what I want to use. At least thats what I
started to work with since there is an example in the manual, which is a
fit of a single exponential.
y(t) = A1exp{-lambda_1*t} + b
I wonder if it is possible to use the example and extend it to a fit of
a bi-exponential?
The part that i think would have to be modified is the creation of the
Jacobian matrix. For the single exponential case
it is defined (from the manual)
/* Jacobian matrix J(i,j) = dfi / dxj, */
/* where fi = (Yi - yi)/sigma[i], */
/* Yi = A * exp(-lambda * i) + b */
/* and the xj are the parameters (A,lambda,b) */
double t = i;
double s = sigma[i];
double e = exp(-lambda * t);
gsl_matrix_set (J, i, 0, e/s);
gsl_matrix_set (J, i, 1, -t * A * e/s);
gsl_matrix_set (J, i, 2, 1/s);
I'm not that mathematical and just started to use gsl, so it looks a
little tough to proceed. Wonder if anyone can help to extend the above
lines to the bi-exponential case?
Also, what about independent gaussian errors, sigma_i? In my data each
point can be assumed to have the same error (same sigmas). How can I
calculate sigma for an experimental data set? Is it the standard deviation?
regards
-totte
BTW I'm using the single exponential fitter and it works great.
Martin Jansche wrote:
On Jan 22, 2008 9:09 AM, Totte Karlsson <address@hidden> wrote:
Now I need to find a fitter for a bi exponential decay function, i.e.
y(t) = A1exp{-lambda_1*t} + A2exp{-lambda_2*t}.
In the equation, the A1 and A2 will typically be equal ,(A1 == A2) and
initially set to 1, so the fit will be for lambda_1 and lambda_2.
You can use the multidimensional minimizer API
(http://www.gnu.org/software/gsl/manual/html_node/Multidimensional-Minimization.html)
to optimize the goodness of fit as a function of your two parameters.
You'll have to implement a function which evaluates goodness of fit
for your set of observation and choice of parameters, as well as the
two partial derivatives in lambda_i. Your decay function has simple
partial derivatives; if your fit criterion does too, you're in very
good shape. If your fit criterion is least squares, you can also use
the nonlinear least-squares fitting API
(http://www.gnu.org/software/gsl/manual/html_node/Nonlinear-Least_002dSquares-Fitting.html).
-- mj
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Help-gsl] Fitting biexponential decay,
Totte Karlsson <=