Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Constrained Nonlinear Curve Fit (Not in Base Package)

LabVIEW 8.5 Help
August 2007

NI Part Number:
371361D-01

»View Product Info
Uses either the Levenberg-Marquardt algorithm or the trust-region dog-leg algorithm to determine the set of parameters 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 parameters. You must manually select the polymorphic instance to use.

Use the pull-down menu to select an instance of this VI.

Nonlinear Curve Fit LM bound

data specifies static data that the user-defined function needs at run time.
f(x,a) is a reference to the VI that implements the fitting model. Use the VI template located at labview\vi.lib\gmath\NumericalOptimization\LM model function and gradient.vit to create the VI from a template.
Y specifies the array of dependent values. The number of input points must be greater than zero and greater than the number of initial parameters. The number of elements in Y must be equal to the number of elements in X.
X specifies the array of independent values. The number of input points must be greater than zero and greater than the number of initial parameters. The number of elements in X must be equal to the number of elements in Y.
Weight is the array of weights for the observations Y. Weight must be the same size as Y. If Weight is unwired, this VI sets all elements of Weight to 1. If an element in Weight is less than 0, this VI uses the absolute value of the element.
initial parameters specifies the initial guess for a solution. The success of the nonlinear curve fit depends on how close the initial parameters are to the solution. Therefore, use any available resources to obtain good initial guess coefficients to the solution before you use this VI.
error in describes error conditions that occur before this VI or function runs. The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurred before this VI or function runs. If an error occurs while this VI or function runs, it runs normally and sets its own error status in error out. Use the Simple Error Handler or General Error Handler VIs to display the description of the error code. Use error in and error out to check errors and to specify execution order by wiring error out from one node to error in of the next node.
status is TRUE (X) if an error occurred before this VI or function ran or FALSE (checkmark) to indicate a warning or that no error occurred before this VI or function ran. The default is FALSE.
code is the error or warning code. The default is 0. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.
source specifies the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning. The default is an empty string.
termination specifies the stopping conditions for the fitting process.
max iteration specifies the largest number of iterations of the fitting routine. If the number of iterations exceeds max iterations, the fitting process terminates.
tolerance specifies the relative change in the weighted distance between Y and the current fit. If the relative change falls below tolerance, the fitting process terminates.
parameter bounds is a cluster that contains the upper and lower numeric limits for the parameters being optimized.
parameter maximum contains the highest allowed value of the parameters being optimized. The length of this array must match the length of parameter minimum. The array does not accept exceptional values, such as Inf, –Inf, or NaN.
parameter minimum contains the lowest allowed value of the parameters being optimized. The length of this array must match the length of parameter maximum. The array does not accept exceptional values, such as Inf, –Inf, or NaN.
method specifies the fitting method. The default is Least Square.

0Least Square (default)
1Least Absolute Residual
2Bisquare
number of function calls returns the number of times LabVIEW called f(x,a) during the fitting process.
best nonlinear fit returns the y-values of the fitted model.
best fit parameters returns the array of parameters that minimizes the weighted mean squared error between the solution vector and the observed y-values.
covariance returns the matrix of covariances. Cjk is the covariance between a[j] and a[k]. c[jj] is the variance of a[j]. This VI generates the covariance, C, according to the following equation:

C = (1/2)D^–1

where D is the Hessian of the function with respect to its parameters.
residue returns the weighted mean error of the fitted model.
error out contains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces. Right-click the error out front panel indicator and select Explain Error from the shortcut menu for more information about the error.
status is TRUE (X) if an error occurred or FALSE (checkmark) to indicate a warning or that no error occurred.
code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.
source describes the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning.

Nonlinear Curve Fit TRDL bound

Uses the trust-region dog-leg algorithm to determine the set of parameters 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 parameters.

data specifies static data that the user-defined function needs at run time.
f(x,a) is a reference to the VI that implements the fitting model. Use the VI template located at labview\vi.lib\gmath\NumericalOptimization\LM model function and gradient.vit to create the VI from a template.
Y specifies the array of dependent values. The number of input points must be greater than zero and greater than the number of initial parameters. The number of elements in Y must be equal to the number of elements in X.
X specifies the array of independent values. The number of input points must be greater than zero and greater than the number of initial parameters. The number of elements in X must be equal to the number of elements in Y.
Weight is the array of weights for the observations Y. Weight must be the same size as Y. If Weight is unwired, this VI sets all elements of Weight to 1. If an element in Weight is less than 0, this VI uses the absolute value of the element.
initial parameters specifies the initial guess for a solution. The success of the nonlinear curve fit depends on how close the initial parameters are to the solution. Therefore, use any available resources to obtain good initial guess coefficients to the solution before you use this VI.
error in describes error conditions that occur before this VI or function runs. The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurred before this VI or function runs. If an error occurs while this VI or function runs, it runs normally and sets its own error status in error out. Use the Simple Error Handler or General Error Handler VIs to display the description of the error code. Use error in and error out to check errors and to specify execution order by wiring error out from one node to error in of the next node.
status is TRUE (X) if an error occurred before this VI or function ran or FALSE (checkmark) to indicate a warning or that no error occurred before this VI or function ran. The default is FALSE.
code is the error or warning code. The default is 0. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.
source specifies the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning. The default is an empty string.
termination specifies the stopping conditions for the fitting process.
max iteration specifies the largest number of iterations of the fitting routine. If the number of iterations exceeds max iterations, the fitting process terminates.
tolerance specifies the relative change in the weighted distance between Y and the current fit. If the relative change falls below tolerance, the fitting process terminates.
parameter bounds is a cluster that contains the upper and lower numeric limits for the parameters being optimized.
parameter maximum contains the highest allowed value of the parameters being optimized. The length of this array must match the length of parameter minimum. The array does not accept exceptional values, such as Inf, –Inf, or NaN.
parameter minimum contains the lowest allowed value of the parameters being optimized. The length of this array must match the length of parameter maximum. The array does not accept exceptional values, such as Inf, –Inf, or NaN.
method specifies the fitting method. The default is Least Square.

0Least Square (default)
1Least Absolute Residual
2Bisquare
number of function calls returns the number of times LabVIEW called f(x,a) during the fitting process.
best nonlinear fit returns the y-values of the fitted model.
best fit parameters returns the array of parameters that minimizes the weighted mean squared error between the solution vector and the observed y-values.
covariance returns the matrix of covariances. Cjk is the covariance between a[j] and a[k]. c[jj] is the variance of a[j]. This VI generates the covariance, C, according to the following equation:

C = (1/2)D^–1

where D is the Hessian of the function with respect to its parameters.
residue returns the weighted mean error of the fitted model.
error out contains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces. Right-click the error out front panel indicator and select Explain Error from the shortcut menu for more information about the error.
status is TRUE (X) if an error occurred or FALSE (checkmark) to indicate a warning or that no error occurred.
code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.
source describes the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning.

Resources


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit