class="resources"
Finds the set of linear coefficients slope and intercept, which describe the line that best represents the input data set, using the least-squares solution. This VI is a subVI of the Linear Fit VI. Details

![]() |
Y must contain at least two points: n is greater than or equal to 2. If there are less than two sample points, the VI sets slope and intercept to NaN and returns an error. |
![]() |
X must contain at least two points, n is greater than or equal to 2. If there are less than two sample points, the VI sets slope and intercept to NaN and returns an error. |
![]() |
slope is the slope of the calculated linear fit. |
![]() |
intercept is the intercept of the calculated linear fit. |
![]() |
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. |
The following equation gives the general form of the linear fit.
F = mX + b
where F is the sequence representing the best fitted values, X represents the input sequence X, m is the slope, and b is the intercept.