CLsqFit:new


The new method constructs a new instance of a CLsqFit object. You must call this method before using the class.

Syntax

L = CLsqFit:new()

where

     L is a new CLsqFit object with all properties initialized to default values.

 

The CLsqFit object is initialized with the following default properties:

    n-dimensional polynomial basis function selected. See SetBasisFunc.

    1 data channel. See SetNumChannels.

    0 coefficients specified. See SetNumCoefs.

    0 sample points added. See AddPt and AddPtWt.

Example

The following script creates a CLsqFit object, specifies a line is to be fit using 2 coefficients, adds data and does a fit. The CLsqFit object is deleted when done in order to conserve memory use.

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

delete

CLsqFit class