Last Modified: December 18, 2017

Uses the Levenberg-Marquardt method to determine the set of parameters that best fit the input data set as expressed by a nonlinear function. You implement the nonlinear function using a strictly typed VI reference.

Conditions that terminate the fitting process.

This node terminates the fitting process if this node passes the **maximum iterations** threshold or reaches the **tolerance** threshold.

Maximum number of iterations that the node runs in the fitting process.

**Default: **200

Minimum relative change in the weighted distance between **y** and the current fit.

**Default: **1E-08

Arbitrary values passed to the strictly typed VI reference that implements the nonlinear function.

Reference to the VI that implements the nonlinear function for the fitting model.

Dependent values.

**y** must be greater in size than **initial parameters**. **y** must be the same size as **x**.

Independent values.

**x** must be greater in size than **initial parameters**. **x** must be the same size as **y**.

Weights for the observations.

If **weight** is unwired, this node sets all elements of **weight** to 1. If the length of **weight** does not equal the length of **y**, this node forces the lengths to be equal by padding the end of **weight** with 1 or ignoring the extra elements at the end of **weight**. If an element in **weight** is less than 0, this node uses the absolute value of the element.

Initial guess for a solution.

The success of the nonlinear curve fit depends on how close **initial parameters** is to the solution. Therefore, use any available resources to obtain good initial guess coefficients to the solution before you use this node.

Error conditions that occur before this node runs.

The node responds to this input according to standard error behavior.

Standard Error Behavior

Many nodes provide an **error in** input and an **error out** output so that the node can respond to and communicate errors that occur while code is running. The value of **error in** specifies whether an error occurred before the node runs. Most nodes respond to values of **error in** in a standard, predictable way.

**Default: **No error

Upper and lower numeric limits for the parameters being optimized.

Smallest allowed values of the parameters being optimized.

The input must be empty or the same size as **initial parameters**. This input must be the same size as **maximum**. This input does not allow exceptional values, such as Inf, -Inf, or NaN.

Each element in **minimum** must be less than or equal to the corresponding element in **maximum**. If an element in **minimum** is equal to the corresponding element in **maximum**, this node uses the value of the element as the constant value of that variable throughout the curve fitting.

Greatest allowed values of the parameters being optimized.

The input must be empty or the same size as **initial parameters**. This input must be the same size as **minimum**. This input does not allow exceptional values, such as Inf, -Inf, or NaN.

Each element in **maximum** must be greater than or equal to the corresponding element in **minimum**. If an element in **maximum** is equal to the corresponding element in **minimum**, this node uses the value of the element as the constant value of that variable throughout the curve fitting.

Fitting method.

Name | Value | Description |
---|---|---|

Least Square | 0 | Uses the least square method. |

Least Absolute Residual | 1 | Uses the least absolute residual method. |

Bisquare | 2 | Uses the bisquare method. |

**Default: **Least Square

Values of the nonlinear function that correspond to the independent values.

Parameters that minimize the weighted mean square error between the solution vector and the observed dependent values.

Matrix of covariances.

The element in the *j*th row and *k*th column *c*_{jk} is the covariance between *a*_{i} and *a*_{k}, where *a*_{i} and *a*_{k} are the *j*th and *k*th element in **best fit parameters**, respectively. *c*_{jj} is the variance of *a*_{j}.

Algorithm for Calculating **covariance**

This node computes the covariance matrix **C** using the following equation:
$\mathbf{C}={\frac{1}{2}D}^{-1}$, where *D* is the Hessian of the function with respect to the values in **best fit parameters**.

Number of times that this node called the nonlinear function in the fitting process.

Error information.

The node produces this output according to standard error behavior.

Standard Error Behavior

**error in** input and an **error out** output so that the node can respond to and communicate errors that occur while code is running. The value of **error in** specifies whether an error occurred before the node runs. Most nodes respond to values of **error in** in a standard, predictable way.

Weighted mean square error between **best nonlinear fit** and **y**.

The following equation defines the nonlinear curve fitting model for this node: *y*[*i*] = *f*(*x*[*i*], *a*_{0}, *a*_{1}, *a*_{2}, ...), where *a*_{0}, *a*_{1}, *a*_{2} , ... are the parameters.

The Levenberg-Marquardt method does not guarantee a correct fitting result. The accuracy of the result depends on the compatibility between the data you provide and the curve fitting model you define in **nonlinear function**. You must always verify the fitting results.

**Where This Node Can Run: **

Desktop OS: Windows

FPGA: This product does not support FPGA devices

Web Server: Not supported in VIs that run in a web application