CLsqFit:Fit CLsqFit:GetBasisDim

CLsqFit:GetBasisFunc


The GetBasisFunc method returns the name of the basis function which is either the default "polynomial" or is specified using the SetBasisFunc method.

Syntax

sName = CLsqFit:GetBasisFunc()

bullet.gif    sName is a string that identifies the basis function in use. See Remarks.

Remarks

This function returns a string with the following values:

 

"polynomial"

The built-in (default) n-dimensional polynomial basis function.

"hyperplane"

The built-in hyperplane basis function.

sFuncName

The string name of a user-defined basis function declared in the script.

Example

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 = new_lsqfit()

-- create a CLsqFit object

 

-- no function declared, n-Dimensional polynomial (1) used.

sName = L:GetBasisFunc()

-- fetch the name of the basis function

Printf( "Func= '%s'\n", sName )

-- result: Func= 'polynomial' (the default basis function)

 

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 = new_lsqfit()

-- create a CLsqFit object

L:SetBasisFunc( "MyFunc" )

-- register the basis function

sName = L:GetBasisFunc()

-- fetch the name of the basis function

Printf( "Func= '%s'\n", sName )

-- result: Func= 'MyFunc'

Related Topics

CLsqFit class

SetBasisFunc

 


Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.