CLsqFit:Fit
The Fit method computes the least squares fit using the current data sample and current fit configuration.
bSuccess = CLsqFit:Fit() where bSuccess is a success code, with true indicating success and false indicating failure. |
If the fit fails, false is returned. Error information can be obtained using GetErrChan and GetErrMsg.
This example creates a CLsqFit object, adds some points, and then computes the fit. if the fit is not successful, the script lists error information and exits.
|
-- create a CLsqFit object |
|
-- set 2 coefficients to fit a line |
|
-- add a point for x = 3.5, y = 5.15 |
|
-- add a point |
|
-- add a point |
|
-- Fit the line, check the results |
|
-- if fit was not successful, then... |
|
-- get the error channel |
|
-- get the error message |
|
-- exit the script and list the error message |
|
|
|
-- list the standard deviation of the fit |
|
-- do other things with the fit |