Levenberg-Marquardt NonLinearFit

From
Alex Astafiev (2:5000/228.16)
To
All
Date
2002-12-09T21:47:02Z
Area
RU.ALGORITHMS
А что ты слышал про распределенные вычисления folding@home, дорогой All?

*******************************************************************************
Разыскиваю алгоритм (реализацию, имплементацию) следующей функции:
int status = NonLinearFit (double x[], double y[], double z[], int n, ModelFun
*modelFunction, double a[], int ncoef, double *mse);
*******************************************************************************


Purpose

Uses the Levenberg-Marquardt algorithm to determine the least squares set of
coefficients that best fit the set of input data points (x, y) as expressed by
a nonlinear function y = f(x, a) where a is the set of coefficients.
NonLinearFit also gives the best fit curve y = f(x, a).

You must pass a pointer to the nonlinear function f(x, a) along with a set of
initial guess coefficients a. NonLinearFit does not always give the correct
answer. The correct output sometimes depends on the initial choice of a. It is
very important to verify the final result.

Parameters

Input

Name Type Description
x    double-precision
array     Array of x-coordinates of the (x, y) data sets to fit.
y    double-precision
array     Array of y-coordinates of the (x, y) data sets to fit.
n    integer   Number of elements in both the x and y arrays.
modelFunction  ModelFun  Pointer to the model function, f(, a), used in the
nonlinear fitting algorithm. The model function must be defined as follows:
double ModelFunct
(double x, double a[],
int ncoef);
where a contains the function coefficients.
a    double-precision
array     On input, a gives a set of initial guess coefficients.
ncoef     integer   Number of coefficients (size of a).
Output

Name Type Description
z    double-precision
array     Best fit array, y = f(x, a).
a    double-precision
array     Best fit coefficients.
mse  double-precision    Mean squared error between y and z.



---
 * Origin: Фидонет - сеть друзей. Будьте дружественнее! (2:5000/228.16)