CLsqFit:GetBasisDim
The GetBasisDim method returns the number of dimensions of independent variable. This value was set using the SetNumCoefs method.
nDim = CLsqFit:GetBasisDim() where |
nDim is a number between 1 and 10.
This function returns the number of independent variables used in the fit. This equals the dimension of the basis. The sample points must be added with data for the corresponding number of dimensions as shown in AddPt and AddPtWt.
The following script retrieves the number of dimensions used by the basis function being fit.
|
-- create a CLsqFit object |
|
-- no function declared, n-dimensional polynomial (1) used |
|
-- Declare a 2x2 coefficient fit |
|
-- fetch the number of basis dimensions |
|
-- result: Dim = 2 |
The next example defines a basis function in the script and registers it, The basis function fits 2 coefficients to one independent variable (i.e., 1 dimension). The script then fetches the basis function properties.
|
-- declare a basis function |
|
|
|
|
|
|
|
|
|
-- end of basis function |
|
-- create a CLsqFit object |
|
-- register the basis function |
|
-- fit 2 coefficients in 1 dimension |
|
|
|
-- fetch the number of basis dimensions |
|
-- result: Dim 'MyFunc' = 1 |