CLsqFit:IsCoefForced CLsqFit:ResetForcedCoefs

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    The n-dimensional polynomial basis function is selected. See SetBasisFunc.

bullet.gif    1 data channel. See SetNumChannels.

bullet.gif    0 coefficients are specified. See SetNumCoefs.

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

bullet.gif    Data rejection is disabled.

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 of the polynomial (line)

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