new_lsqfit


The new_lsqfit is a non-class version of the CLsqFit:new method which creates and returns a newa CLsqFit object.

Syntax

L = new_lsqfit()

bullet.gif    L is returned as the new CLsqFit object.

bullet.gif    On failure, nil is returned.

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

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

G = new_lsqFit()

-- create 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, new, delete

 


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