CLsqFit:SetBasisFunc
The SetBasisFunc method selects the basis function to use for the fit. This function selects one of the two built-in basis functions or a function you specify in the script..
CLsqFit:SetBasisFunc( selection ) |
This function takes either a number of string value to select the basis function. Mira interprets a number value as a built-in basis function. A string is interpreted as the name of a function in the script:
1 |
The built-in (default) n-dimensional polynomial basis function. |
2 |
The built-in hyperplane basis function. |
(else) |
The name of a basis function defined in the script. |
Note that the value returned by GetBasisFunc is always a string. The number index 1 or 2 is returned as a string as is the name of a basis function declared in the script.
The following script selects the built-in hyperplane basis function.
L = CLsqFit:new() |
-- create a CLsqFit object |
|
-- no function declared, n-dimensional polynomial (1) assumed |
|
-- select built-in function 2, the Hyperplane |
|
|
|
-- result: Func= '2' |
To next example declares a basis function in the script and then registers it for use. This function fits a line about the origin:
|
-- declase the basis function |
|
-- declare a lua table for the basis vector |
|
-- basis vector element [1] is 1 |
|
-- basis vector element [2] is c[1] |
|
-- return the basis vector |
|
-- end of the basis function |
L = CLsqFit:new() |
-- create a CLsqFit object |
|
-- register the script function "F" |
|
|
|
-- result: Func= 'Line' |