Finds the line values and the set of linear coefficients slope and intercept that describe the line that best represents the input data set. Details
![]() |
initialize, when TRUE, initializes the internal state of the VI. |
![]() |
input data y is a set of input data. |
![]() |
input data x is a set of input data. |
![]() |
sample length is the length of each set of incoming data. The VI performs computation for each set of data. The default is 100. When you set sample length to zero, the VI calculates a cumulative solution for the input data from the time that you called or initialized the VI. When the sample length setting is greater than zero, the VI calculates the solution for only the newest set of input data. |
![]() |
Best Linear Fit is the calculated values of best linear fit. |
![]() |
slope is the slope of the line that best represents the input data set. |
![]() |
intercept is the intercept value of the line that best represents the input data set. |
![]() |
mse is the mean squared error. |
![]() |
error returns any error or warning condition from the VI. Refer to Point By Point Error Codes for more information about these conditions. |
The general form of the output is
F = mX + b,
where F is the set of output data Best Linear Fit, X is the set of input data input data x, m is the slope, b is the intercept.
The MSE between the output Best Linear Fit and the set of input data y is computed using the MSE PtByPt VI and returned in mse, as shown in the following equation.
mse = 1/n* sum[f(i)-y(i)]^2,
where n is the number of elements in the set of input data, f is Best Linear Fit, and y is input data y.