CLsqFit:new


The new method constructs a new instance of a CLsqFit object. You must call this method before using the class. Note that the object can also be created using new_lsqfit.

Syntax

L = CLsqFit:new()

bullet.gif    Creates a default CLsqFit object and returns it as L.

bullet.gif    L is the new instance of the CLsqFit class.

Remarks

The new CLsqFit object is initialized with the following default properties:

bullet.gif    n-dimensional polynomial basis function selected. See SetBasisFunc.

bullet.gif    1 data channel. See SetNumChannels.

bullet.gif    0 coefficients specified. See SetNumCoefs.

bullet.gif    0 sample points added. See AddPt and AddPtWt.

Example

Thefollowing script creates a CLsqFit object, adds some data, and performs a fit. Since SetBasisFunc is not used, a polynomial function is assumed.

L = CLsqFit:new()

-- create a CLsqFit object

L:SetNumCoefs( 2 )

-- set 2 coefficients

L:AddPt( 3.5, 5.15 )

-- add a point for x = 3.5, y = 5.15

L:AddPt( -12, 14 )

-- add a point

L:AddPt( -2, -4.25 )

-- add a point

L:Fit()

-- Fit the line

 

-- do something with the results

L:delete()

-- best delete from memory when you are finished

Related Topics

CLsqFit class, delete, new_lsqfit


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