[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: [Help-gsl] Beginner trying to use nonlinear least squares

**From**: |
Martin Jansche |

**Subject**: |
Re: [Help-gsl] Beginner trying to use nonlinear least squares |

**Date**: |
Thu, 6 Oct 2005 20:23:48 -0400 |

On 10/6/05, James Fitzsimons <address@hidden> wrote:
>* How would I construct a gsl_multifit_function_fdf for this?*
I'm not sure I fully understand the core of your question. If it's
about the GSL API, have you looked at the example in the manual
(http://www.gnu.org/software/gsl/manual/gsl-ref_37.html#SEC492)? In
essence, you'll have to separate the parameters of your function into
those you wish to adjust and those you don't. Gather all the latter
ones into a struct, and pass a pointer to that struct around as the
value of the params argument. Next, the adjustable parameters have to
be treated as components of a gsl_vector. Then, in the simplest case,
you would write two C functions: one which evaluates the function at a
given point, and one which computes the partial derivatives at a given
point. Initially you can write a naive fdf function which simply
calls the f() and df() functions. Then allocate a
gsl_multifit_function_fdf structure (automatic or static allocation
often works), initialize it with the function pointers and other data,
and you're good to go. If you have specific questions about your
function, you'd probably have to post some more details about that
function. What may be confusing is that it's possible to
simultaneously fit several functions with common adjustable
parameters.
-- mj