Table Of Contents

Nonlinear Curve Fitting (Levenberg-Marquardt » VI) (G Dataflow)

Version:
    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.

    connector_pane_image
    datatype_icon

    stopping criteria

    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.

    datatype_icon

    maximum iterations

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

    Default: 200

    datatype_icon

    tolerance

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

    Default: 1E-08

    datatype_icon

    data

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

    datatype_icon

    nonlinear function

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

    datatype_icon

    y

    Dependent values.

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

    datatype_icon

    x

    Independent values.

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

    datatype_icon

    weight

    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.

    datatype_icon

    initial parameters

    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.

    datatype_icon

    error in

    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.

    error in does not contain an error error in contains an error
    If no error occurred before the node runs, the node begins execution normally.

    If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

    If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

    Default: No error

    datatype_icon

    parameter bounds

    Upper and lower numeric limits for the parameters being optimized.

    datatype_icon

    minimum

    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.

    datatype_icon

    maximum

    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.

    datatype_icon

    method

    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

    datatype_icon

    best nonlinear fit

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

    datatype_icon

    best fit parameters

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

    datatype_icon

    covariance

    Matrix of covariances.

    The element in the jth row and kth column cjk is the covariance between ai and ak, where ai and ak are the jth and kth element in best fit parameters, respectively. cjj is the variance of aj.

    Algorithm for Calculating covariance

    This node computes the covariance matrix C using the following equation: C = 1 2 D 1 , where D is the Hessian of the function with respect to the values in best fit parameters.

    datatype_icon

    number of function calls

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

    datatype_icon

    error out

    Error information.

    The node produces this output 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.

    error in does not contain an error error in contains an error
    If no error occurred before the node runs, the node begins execution normally.

    If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

    If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.
    datatype_icon

    residue

    Weighted mean square error between best nonlinear fit and y.

    Nonlinear Curve Fitting Model

    The following equation defines the nonlinear curve fitting model for this node: y[i] = f(x[i], a0, a1, a2, ...), where a0, a1, a2 , ... are the parameters.

    Caveats of the Levenberg-Marquardt Method

    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


    Recently Viewed Topics