class="resources"
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. Details Example

![]() |
Standard Deviation is the array of standard deviations, sigma[i], for data point (x[i],y[i]). If the standard deviations are all equal or if they are unknown, do not wire this input and use the default of 1.0. | ||||
![]() |
X is the array of data points representing the independent variable x. Scale the X-data so that delta X is at least 1E-2. | ||||
![]() |
Y is the array of data points representing the observed values of the dependent variable y. | ||||
![]() |
Initial Guess Coefficients is your initial guess of the solution coefficients. | ||||
![]() |
max iteration is the maximum executing iteration. If the VI reaches maximum iteration without finding a solution, the VI returns an error. You must increase the max iteration or adjust the Initial Guess Coefficients to get a solution. | ||||
![]() |
derivative specifies the method used to calculate the Jacobian.
Use the formula you specified in the Formula Node on the block diagram of the Target Fnc & Deriv NonLin VI to compute the Jacobian. Refer to the Details section for information about the Target Fnc & Deriv NonLin VI.
|
||||
![]() |
Covariance is the matrix of covariances C. cjk is the covariance between aj and ak. cjj is the variance of aj. | ||||
![]() |
Best Fit Coefficients is the set of coefficients that minimize chi-square. | ||||
![]() |
Best Fit is the fitted data.
The VI calculates Best Fit using the following equation. zi = f(xi)A, where A is Best Fit Coefficients. |
||||
![]() |
mse is the mean squared error. | ||||
![]() |
error returns any error or warning from the VI. You can wire error to the Error Cluster From Error Code VI to convert the error code or warning into an error cluster. |
This VI determines the set of coefficients that minimize the chi-square quantity. The following equation defines
2.

In the previous equation, (xiyi) are the input data points, and f is the nonlinear function
f(xi; a1 aM) = f(X, A)
where a1
aM are coefficients. If the measurement errors are independent and normally distributed with constant, standard deviation
i =
, the minimum
2 fit is equivalent to the least-square fit.
You must specify the nonlinear function f = f(X,A) in the Formula Node on the block diagram of the Target Fnc & Deriv NonLin VI, which is a subVI of the Nonlinear Lev-Mar Fit VI. To access the Target Fnc & Deriv NonLin VI, select Browse»This VI's SubVIs»Target Fnc & Deriv NonLin.vi.
The Nonlinear Lev-Mar Fit VI provides the following two methods to calculate the Jacobian (partial derivatives with respect to the coefficients) needed in the algorithm:
in the Formula Node on the block diagram of the Target Fnc & Deriv NonLin VI, as well as the nonlinear function f = f(X,A) This is a more efficient computation than the numerical calculation, because it does not require a numerical approximation to the Jacobian.The input arrays X and Y define the set of input data points. The Nonlinear Lev-Mar Fit VI assumes that you have prior knowledge of the nonlinear relationship between the x and y coordinates. That is, f = f(X,A), where the set of coefficients, A, is determined by the Levenberg-Marquardt algorithm.
Using the Nonlinear Lev-Mar Fit VI successfully sometimes depends on how close your initial guess coefficients are to the solution. Therefore, it is always worth taking effort and time to obtain good initial guess coefficients to the solution from any available resources before using the function.
Refer to the Nonlinear Lev-Mar Exponential Fitting VI in the labview\examples\analysis\regressn.llb directory for an example of using the Nonlinear Lev-Mar Fit VI.