General Linear Fit VI
- Updated2025-07-30
- 4 minute(s) read
Finds the k-dimension linear curve values and the set of k-dimension linear fit coefficients, which describe the k-dimension linear curve that best represents the input data set using the Least Square, Least Absolute Residual, or Bisquare method.

Inputs/Outputs
covariance selector
—
covariance selector indicates whether the VI computes the covariance matrix.
Y
—
Y is the observed data set Y. The number of elements in Y must equal the number of rows in H.
H
—
H is the matrix that represents the formula you use to fit the data set (X, Y). Hij are the function values of Xi.
Weight
—
Weight is the array of weights for the observations Y. Weight must be the same size as Y. If you do not wire an input to Weight, this VI sets all elements of Weight to 1.
tolerance
—
tolerance determines when to stop the iterative adjustment of Coefficients when you use the Least Absolute Residual or Bisquare methods. For the Least Absolute Residual method, if the relative difference of the weighted mean error of the polynomial fit in two successive iterations is less than tolerance, this VI returns the resulting Polynomial Coefficients. For the Bisquare method, if any relative difference between Polynomial Coefficients in two successive iterations is less than tolerance, this VI returns the resulting Polynomial Coefficients.
method
—
method specifies the fitting method.
algorithm
—
algorithm specifies the algorithm this VI uses to compute Best Fit. Use the SVD for Rank Deficient H algorithm only if H is rank deficient or does not have a full rank and if all other algorithms are unsuccessful.
Best Fit
—
Best Fit is the fitted data computed by using Coefficients.
Coefficients
—
Coefficients is the set of coefficients that minimize chi squared.
Covariance
—
Covariance is the matrix of covariance C with k-by-k elements.
Weight Out
—
Weight Out returns the actual weight of general linear fitting if method is Bisquare. If method is Least Square or Least Absolute Residual, Weight Out returns the value you enter for Weight.
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.
residue
—
residue returns the weighted mean error of the fitted model. If method is Least Absolute Residual, residue is the weighted mean absolute error. Otherwise, residue is the weighted mean square error. |
covariance selector
—
Y
—
H
—
tolerance
—
method
—
Best Fit
—
Covariance
—
error
—
residue
—