[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: choosing parameters for curvefit
nospam@ll.mit.edu (Joseph Scott Stuart) writes:
>
> I'm using curvefit to fit a function with a bunch of parameters to a
> dataset. I'd like to be able to easily specify that some parameters
> should be held constant on a particular run, while others are fit. I
> want to do this to explore how well the curvefit is going and to
> explore the parameter space. The only way I've come up with so far to
> do this is using commons blocks as below. If you can think of another
> way to do this, let me know. I'd like to avoid common blocks on
> aesthetic grounds, but there doesn't seem to be any other way to pass
> extra information to the function that curvefit calls.
>
> ... Code deleted ...
May I recommend that you try MPFIT, available from
http://astrog.physics.wisc.edu/~craigm/idl
MPFIT is a Levenberg-Marquardt fitter, translated from the FORTRAN
MINPACK-1 sources available on netlib. I have generally found this
fitter to be quite robust. So far, no complaints from the net either!
MPFIT allows you to easily hold parameters fixed (or not).
Investigate the documented PARINFO keyword, and also the tutorial page
accessible from the above page, for more information. In addition,
MPFIT allows you to put lower and upper bounds on parameter values.
Using MPFIT is easy. If you use MPFITFUN, you supply a function which
computes the "model" function, including vector functions, and of
course your data. MPFIT computes LM derivatives numerically, saving
you from the trouble of doing it yourself. Fitting two- or
three-dimensional data is just as easy.
Craig
--
--------------------------------------------------------------------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@astrog.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
--------------------------------------------------------------------------