CLsqFit:Using CLsqFit with Image Pixels CLsqFit:delete

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()

  • Creates a default CLsqFit object with all properties initialized to default values.
  • L is the new instance of the CLsqFit class.

Remarks

The CLsqFit object is initialized with the following default properties:

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

CLsqFit class, delete