CLsqFit:ResetPoints


The ResetPoints method deletes all sample points from the fit. In contrast, the delete method deletes the entire CLsqFit object. Use ResetPoints if you want to add all new sample points but retain the other properties of the existing CLsqFit object.

Syntax

CLsqFit:ResetPoints()

  

After using ResetPoints, you must re-build the sample point collection using AddPt or AddPtWt. If you instead used the delete method to remove all the sample points, you would have to create a new CLsqFit object and then setup the basis function, number of channels, number of coefficients, forced coefficients, etc.

Example

The following example accumulates sample points and computes a fit, then deletes all points, accumulates a new sample points, and computes a fit to the new data:

L = CLsqFit:new()

-- create a CLsqFit object

L:SetNumCoefs( {2,2} )

-- fit 2x2 coefs to a polynomial

L:AddPt( -3, 1, 2 )

-- add some points

L:AddPt( 4, 5, 3 )

 

 

-- add more points

L:Fit()

-- do the fit

 

-- do something with the fit results

L:ResetPoints()

-- get rid of all points

L:AddPt( 3, 2, 5.5 )

-- add some new points

L:AddPt( 4, 5, 3 )

 

 

-- add more points

L:Fit()

-- do a new fit

Related Topics

AddPt

AddPtWt

CLsqFit class