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

Robust curve fitting

There has been some recent discussion on this newgroup about curve
fitting.  Specifically, people wanted a faster system with more
features.  I also wanted a curve fitting routine that didn't cause IDL
to crash.

I recently had an opportunity to translate the MINPACK-1 curve-fitting
package into IDL.  MINPACK is a minimization package available from
netlib, and has an excellent reputation.  I have found that it is much
more robust, able to cope with singular matrices, etc.  Since people
have been requesting, I polished it up a little bit, and am making it
available via my IDL web page:


In addition to three IDL procedures (MPFIT, MPFITFUN, and MPFITEXPR)
which are extensively documented, I have written a short tutorial page
on how to use them
(http://astrog.physics.wisc.edu/~craigm/idl/fittut.html).  You should
download all three routines.

The easiest to use routine, MPFITEXPR, does not even require you to
compile a separate IDL function.  You just type the expression you
want, as a string!  I have found this indispensable for interactive


  * can fit arbitrary expressions from the command line without
    compiling a special IDL function (see MPFITEXPR).

  * you can fix any parameters you wish (see PARINFO keyword).

  * you can place upper and lower limits on parameter values.
    (see PARINFO keyword).

  * you can pass additional keywords to your function in a manner
    similar to the _EXTRA mechanism (see the FUNCTARGS keyword).

  * the function evaluation is a vector operation, so it avoids
    time-consuming FOR loops.

  * it computes the entire covariance matrix (see COVAR keyword)

  * partial derivatives are calculated automatically and numerically,
    freeing you from the need to compute them analytically yourself.

I get very good performance on my machine!  Download them and give a
try.  As always, feedback is appreciated.


Craig B. Markwardt, Ph.D.         EMAIL: craigmnet@astrog.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response