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 )

where

    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.

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

  

This method returns the limiting values of the observations, or "y" values, 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 = CLsqFit:new()

-- 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 minimum and maximum x values

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

-- Result: 2, 70

Related Topics

GetRangeX

CLsqFit class