CLsqFit:GetRangeObs


The GetRangeObs method returns the minimum and maximum values of the observations, or independent variable, in the data sample.

Syntax

nMinY,nMaxY = CLsqFit:GetRangeObs()

nMinY,nMaxY = CLsqFit:GetRangeObs( nChannel )

bullet.gif    nChannel is an optional parameter that specifies the channel when using multi-channel data as from an RGB image. If the data have 1 dimension, you do not need to specify the channel.

bullet.gif    nMinY and nMaxY are the minimum and maximum values, respectively.

Remarks

This method returns the limiting values of the observations (or "y" values for a fit to 1 basis dimension), in the sample data. If the data have multiple channels, you must specify which channel to return.

Example

The following example returns the minimum and maximum y ("observation") values in the data:

L = new_lsqfit()

-- create a CLsqFit object

L:SetNumCoefs( 2 )

-- set 2 coefficients

L:AddPt( -4.5, 2 )

 

L:AddPt( 5.2, 20 )

 

L:AddPt( 10.1, 35.5 )

 

L:AddPt( 13, 50 )

 

L:AddPt( 18.7, 65 )

 

L:AddPt( -3, 7 )

 

L:AddPt( 4, 25 )

 

L:AddPt( 9.7, 40 )

 

L:AddPt( 11, 55 )

 

L:AddPt( 14.5, 70 )

 

L:Fit()

-- Fit the line

y1, y2 = L:GetRangeObs()

-- find the range of x values

Printf("%lg,%lg\n", y1, y2 )

-- Result: 2, 70

 

Related Topics

CLsqFit class, GetRangeX


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