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.

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:

 

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.

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= '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 = 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, Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.