class="resources"
Finds the polynomial curve values and the set of Polynomial Fit Coefficients, which describe the polynomial curve that best represents the input data set. Details Examples

![]() |
Y is the array of dependent values. The number of sample points in Y must be greater than polynomial order. If the number of sample points is less than or equal to polynomial order, the VI sets Polynomial Fit Coefficients to an empty array and returns an error. | ||||||||||||
![]() |
X is the array of independent values. The number of sample points in X must be greater than polynomial order. If the number of sample points is less than or equal to polynomial order, the VI sets Polynomial Fit Coefficients to an empty array and returns an error. | ||||||||||||
![]() |
polynomial order must be greater than or equal to zero. If polynomial order is less than zero, the VI sets Polynomial Fit Coefficients to an empty array and returns an error. The default is 2. 0 where n is the number of sample points and m is the polynomial order. |
||||||||||||
![]() |
algorithm specifies the algorithm the VI uses to compute Best Polynomial Fit.
|
||||||||||||
![]() |
Best Polynomial Fit is the polynomial curve values that best represent the input data set. | ||||||||||||
![]() |
Polynomial Fit Coefficients returns the coefficients describing Best Polynomial Fit. The total number of elements in Polynomial Fit Coefficients is m + 1, where m is the polynomial order. | ||||||||||||
![]() |
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. |
Example
The following equation gives the general form of the polynomial fit.

where F represents the output sequence Best Polynomial Fit, X represents the input sequence X, a represents the Polynomial Fit Coefficients, and m is the polynomial order.
The VI calculates mse using the following equation.

where Y represents the input sequence Y and n is the number of data points.
The General Polynomial Fit VI is a special case of the General LS Linear Fit. The General Polynomial Fit VI uses the General LS Linear Fit VI as a subVI. The General Polynomial Fit VI builds the H matrix internally using input X for the General LS Linear Fit VI.
The following equations define the formula used to build H:
hij = fj(xi) = xji
i = 0, 1, , n 1
j = 0, 1, , m
For example,

Refer to the following VIs for examples of using the General Polynomial Fit VI: