Linear Fit (Not in Base Package)

Finds the line values and the set of linear coefficients slope and intercept, which describe the line that best represents the input data set. Details

Y Values must contain at least two points. n is greater than or equal to 2. If there are fewer than two sample points, the VI sets Best Linear Fit to an empty array, sets slope, intercept, and mse to NaN, and returns an error through the Linear Fit Coefficients VI. Refer to Linear Fit Coefficients for more information about this VI.
X Values must contain at least two points. n is greater than or equal to 2. If there are fewer than two sample points, the VI sets Best Linear Fit to an empty array, sets slope, intercept, and mse to NaN, and returns an error through the Linear Fit Coefficients VI. Refer to Linear Fit Coefficients for more information about this VI.
Best Linear Fit is the calculated values of best linear fit.
slope is the slope of Best Linear Fit.
intercept is the intercept of Best Linear Fit.
mse is the mean squared error.
error returns any error or warning condition from the VI.

Linear Fit Details

The general form of the linear fit is given by F = mX + b, where F represents the output sequence Best Linear Fit, X represents the input sequence X Values, m is the slope, and b is the intercept. The VI obtains mse using the formula

where F represents the output sequence Best Linear Fit, Y represents the input sequence Y Values, and n is the number of data points.