CLsqFit:GetObs CLsqFit:GetPolyCoefIndex

CLsqFit:GetWt


The GetWt method returns a table containing the weights for all points in the data sample. If multichannel data are fit, the function returns 1 table for each data channel. The returned table contains CLsqFit:GetNumPts() values. To get the weight of a single point, use GetPtWt.

Syntax

tblWt = CLsqFit:GetWt()

tblWt = CLsqFit:GetWt( nChannel )

tblWt1, tblWt2, tblWt3, tblWt4 = CLsqFit:GetWt()

bullet.gif    nChannel is the optional channel to select for multi-channel data.

bullet.gif    tblWt is a 1-dimensional array containing the weights assigned all points.

bullet.gif    tblWt1, tblWt2, tlWt3, tblWt4 are 1-dimensional array with values that are numbers. of weights assigned to points that have multi-channel (e.g., RGB) values. The number of tables returned equals the number of channels.

Remarks

Two forms are provided with a different number of return values. If the point uses single-channel data (i.e., typical numeric data) or you specify the channel, then a single table is returned. If the point involves multi-channel data, up to 4 tables will be returned. The number of tables returned equals the number of channels of data that were fit.

Example

The following example fitsreturns the number of fit points that had a weight >= 5.0:

L = new_lsqfit()

-- create a CLsqFit object

L:SetNumCoefs( 2 )

-- set 2 coefs to fit a line to single channel data

L:AddPtWt( 3.5, 5.15, 10 )

-- add a point for x = 3.5, obs = 5.15, weight = 10

-- add more points to the fit

 

L:Fit()

-- Fit the line

nHigh = 0

-- initialize a counter

for k,w in ipairs( L:GetWt() ) do

-- loop over all points k having weight w

  if w > 5 then nHigh = nHigh + 1 end

-- w is the k-th weight

end

 

Printf("Num weights > 5 = %d\n", nHigh )

--list the results

Related Topics

CLsqFit class

GetPtWt

SetPtWt

AddPtWt

GetX

GetObs

 


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