CLsqFit:GetBasisFunc
The GetBasisFunc method returns the basis function currently registered with the CLsqFit object. The basis function is either the default built-in n-dimensional polynomial or a function that was set using the SetBasisFunc method.
sName = CLsqFit:GetBasisFunc() |
This function returns a string with the following values:
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. |
The following script retrieves the name of the basis function in use. In this example, no function is registered using SetBasisFunc, so the built-in n-dimensional polynomial is used by default.
L = CLsqFit:new() |
-- create a CLsqFit object |
|
-- no function declared, n-Dimensional polynomial (1) used. |
|
-- fetch the name of the basis function |
|
-- result: Func= '1' |
The next example defines a basis function in the script and registers it, The name of the basis function is then fetched and listed.
function MyFunc( n, c ) |
-- declare a basis function to fit a line |
b = {} |
|
b[1] = 1 |
|
b[2] = c[1] * c[1] |
|
return b |
|
end |
-- end of basis function |
|
|
L = CLsqFit:new() |
-- create a CLsqFit object |
|
-- register the basis function |
|
-- fetch the name of the basis function |
|
-- result: Func= 'MyFunc' |