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. This topic and the details of parameter passing are discussed in Basis Functions.
CLsqFit:SetBasisFunc( selection ) where |
selection is a number or string specifying the basis function. To use a built-in basis function, pass its number. To specify a basis function declared in the script, pass its name as a string.
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.
|
-- 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, named "Line", fits a line:
|
-- declare the basis function |
|
-- declare an array 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 |
|
-- create a CLsqFit object |
|
-- register the script function "Line" |
|
|
|
-- result: Func= 'Line' |