CLsqFit:SetPtWt
The SetPtWt method alters the weight assigned to an existing sample point. The point must have been previously added to the sample using AddPt or AddPtWt. The number of coordinate values (independent variables) must match the dimensions of the fit specified using the SetNumCoefs method.
CLsqFit:SetPtWt( nIndex, nWt ) CLsqFit:SetPtWt( nIndex, nWt, nChannel ) |
nIndex is the index of the point in the sample, beginning at index 1.
nChannel is the optional channel to select for multi-channel data.
nWt is the weight to assign the point.
The SetPtWt method uses the index of the target point. The index must either be known from the order that points were added to the sample, or determined by matching the target point's values using FindPt or a more complicated procedure such as using GetResid to identify the indices of points having high residuals from the fit. You also may fetch the weight currently assigned to a point using GetPtWt.
The following example illustrates how to change the weight of an existing point. In this case, the target point's index is found by matching its values:
|
-- create a CLsqFit object |
|
-- set 2 coefficients to fit a line |
|
-- add a point for x = 3.5, y = 5.15, weight = 1 |
-- add more points to the fit |
|
|
-- Fit the line |
-- do something with the fit results |
|
|
-- find the point (if we don't know it has index 1) |
|
-- set the weight of point 1 to 10.0 |
|
-- get a new fit result using different weights |
CLsqFit class, GetPtWt, AddPt, FindPt, GetResid
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics,
Inc. All Rights Reserved.