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

bullet.gif    This method has no arguments or return value.

Remarks

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

-- 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 to the fit

 

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 to the fit

 

L:Fit()

-- do a new fit

Related Topics

CLsqFit class, delete, AddPt, AddPtWt


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