help-gsl
[Top][All Lists]

## RE: [Help-gsl] Additional parameters in Non-linear least-squares fitting

 From: KENNETH.MCFARLANE Subject: RE: [Help-gsl] Additional parameters in Non-linear least-squares fitting? Date: Sun, 30 Jul 2006 16:03:23 -0400

```Thanks.  I was able to get this to work on my sample problem, with the
following combination:
the number of parameters to be fit nfit = 3.
the number of parameters for the function npars = 4 (the first 3 are the ones
to be fit)
set f.p = nfit;
gsl_vector length npars
gsl_matrix *covar = gsl_matrix_alloc (nfit, nfit);
s = gsl_multifit_fdfsolver_alloc (T, n, npars);
gsl_multifit_fdfsolver_set (s, &f, &x.vector);

the functions f.f and f.df use all four parameters, but the fourth is treated
as a constant.

No error messages about vector length and the result on a test is 'correct.'

Thanks for your help.

Regards,
Ken McF

________________________________

From: Martin Jansche [mailto:address@hidden
Sent: Sun 7/30/2006 1:58 PM
To: McFarlane Kenneth
Subject: Re: [Help-gsl] Additional parameters in Non-linear least-squares
fitting?

> I need to pass additional parameters to the functions used by the N-L L-S
> fitting
> routines.  The functions I want to fit may have 6 parameters but I want to
> vary
> only 3 during the fit.

This means that, as far as the GSL API is concerned, you want to fit a
function with three parameters.  Additional parameters can be passed
via the void *params argument of the component f of the structure
gsl_multifit_function.  You may want to write one or more wrapper
routines that take a vector of parameters plus a boolean vector
indicating which parameters you want to vary as arguments and return
an appropriate gsl_multifit_function.

Regards,
-- mj

======================================================================
The information contained in this message is intended only for the recipient,
and may otherwise be privileged and confidential. If the reader of this message
is not the intended recipient, or an employee or agent responsible for
delivering this message to the intended recipient, please be aware that any
dissemination or copying of this communication is strictly prohibited. If you
have received this communication in error, please immediately notify us by
replying to the message and deleting it from your computer. This footnote also
confirms that this email has been scanned for all viruses by the Hampton
Universitys Center for Information Technology Enterprise Systems service.

```

reply via email to