CLsqFit:GetPtObs


The GetPtObs method returns the observed value for an existing sample point.

Syntax

nZ = CLsqFit:GetPtObs( nIndex )

nZ = CLsqFit:GetPtObs( nIndex, nChannel )

nZ1, nZ2, nZ3, nZ4 = CLsqFit:GetPtObs( nIndex )

bullet.gif    nIndex is the index of the point in the sample, beginning at index 1.

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

bullet.gif    nZ is the observed value of the point.

bullet.gif    nZ1, nZ2, nZ3, nZ4 are the observed values of a point that has multi-channel (e.g., RGB) values. The number of values returned equals the number of channels.

Remarks

The GetPtObs 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 involving GetResid or other method.

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 value is returned. If the point involves multi-channel data, up to 4 values will be returned. The number of values returned is determined by the SetNumChannels method. The status can be modified using SetPtObs.

Example

The following example illustrates how to change the y value of an existing point. In this case, the target point's index is found by matching its values:

L = new_lsqfit()

-- create a CLsqFit object

L:SetNumCoefs( 2 )

-- set 2 coefficients to fit a line

L:AddPt( 3.5, 5.15 )

-- add a point for x = 3.5, y = 5.15, weight = 1

-- add more points to the fit

 

L:Fit()

-- Fit the line

-- do something with the fit results

 

n = L:FindPt( 3.5, 5.15 )

-- find the point (if we don't know it has index 1)

y = L:GetPtObs(n)

-- get the point's y value

L:SetPtObs( n, y + 0.05 )

-- add 0.05 to the point value

L:Fit()

-- get a new fit result using the new value

Related Topics

CLsqFit class, SetPtObs, AddPt, FindPt


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