class="resources" Curve Fitting (Not in Base Package) - LabVIEW 7.1 Help - Support - National Instruments
Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Curve Fitting (Not in Base Package)

Computes the coefficients that best represent the input data.

Dialog Box Options
Block Diagram Inputs
Block Diagram Outputs

Dialog Box Options

ParameterDescription
Model TypeContains the following options:
  • Linear—Finds the slope and intercept of the line that best represents the input data set in the least-squares sense.
  • Quadratic—Finds the polynomial curve of order 2 that best represents the input data set in the least-squares sense.
  • Spline—Returns the spline interpolant of length n. n contains the second derivatives of the spline interpolating function g(x) at the tabulated points , where i = 0, 1, …, n – 1.
  • Polynomial—Finds the set of polynomial fit coefficients that best represents the input data set in the least-squares sense.
    • Polynomial order—Must be greater than or equal to zero. If Polynomial order is less than zero, the Express VI returns an error. The default is 5. This option is available only when you select the Polynomial option. The value of polynomial order must observe the following relationship:

      0 m < n – 1,

      where n is the number of sample points, and m is Polynomial order.

  • General least squares linear—Finds the k-dimension linear curve values and the set of k-dimension linear fit coefficients that best represents the input data set using the least-squares solution.
    • Models—Individual functions of the independent variable. This option is available only when you select the General least squares linear option. In the following equation, the models are the functions of x, namely f0(x), f1(x), …, fn – 1(x).

      where

      a = {a0, a1, a2, …, an – 1}

  • Non-linear—Uses the Levenberg-Marquardt algorithm to determine the set of coefficients of the nonlinear model that best represents the input data set in the least-squares sense. The nonlinear model is expressed by a nonlinear function y = f(x,a), where a is the set of coefficients.
    • Independent variable—Specifies the independent variable in Non-linear model. This option is available only when you select the Non-linear option.
    • Maximum iterations—Maximum number of executing iterations. If the Express VI reaches Maximum iterations without finding a solution, the VI returns an error. You must increase Maximum iterations or adjust Initial guesses to find a solution. The default is 500. This option is available only when you select the Non-linear option.
    • Initial guesses—Initial guesses of the solution coefficients. This option is available only when you select the Non-linear option.
  • Current Model—Displays the formula for the currently selected Model Type. This display is available only when you set Model Type to Linear, Quadratic, Spline, Polynomial, or General least squares linear.
  • Non-linear model—String that describes the model equation. This option is available only when you select the Non-linear option.
ResultsDisplays values generated for the parameters based on the options you select and values you enter.
Data GraphDisplays the original data and the best fit. Best fit is computed by the following equation.

zi = f(xi)A

where A is the best fit coefficient.

Residue GraphDisplays the difference between the original data and the best fit.

Block Diagram Inputs

ParameterDescription
SignalsSpecifies the observed values of the dependent variable.
LocationsSpecifies the values of the independent variables.
error in (no error)Describes error conditions that occur before this VI or function runs.

Block Diagram Outputs

ParameterDescription
interceptReturns the intercept of the calculated best linear fit.
a1Returns the coefficient of the first-order term.
best fitReturns the fitted data. best fit is computed by the following equation.

zi = f(xi)A

where A is the best fit coefficient.

residualReturns the difference between the original data and the best fit.
mean squared errorReturns the mean squared error of the best fit.
error outContains 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.
polynomial coefficientsReturns the coefficients that describe the best polynomial fit. The total number of elements in polynomial coefficients is m + 1, where m is Polynomial order.
slopeReturns the slope of the calculated best linear fit.
a0Returns the constant term of the calculated best quadratic fit.
spline interpolantReturns the second derivative of interpolating function g(x). spline interpolant is the second derivative of interpolating function g(x) at points , i = 0, 1,…, n – 1.
non-linear coefficientsReturns the set of coefficients of the nonlinear model that best represents the input data set in the least-squares sense.
general LS coefficientsReturns the set of coefficients that best represent the input data set in the least-squares sense.
a2Returns the coefficient of the second-order term.

This Express VI uses the functionality of the following VIs and functions:

Linear Fit
Nonlinear Lev-Mar Fit
Polynomial Interpolation
Spline Interpolation


Resources


 

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