CLsqFit:GetRangeX


The GetRangeX method returns the minimum and maximum values of the independent variable in the sample.

Syntax

nMinX,nMaxX = CLsqFit:GetRangeX()

nMinX,nMaxX = CLsqFit:GetRangeX( nDimension )

bullet.gif    nDimension is an optional parameter that specifies the basis dimension (index of the independent variable) when the fit involves more than 1 basis dimension.

bullet.gif    nMinX and nMaxX are the minimum and maximum values, respectively.

Remarks

This method returns the limiting values of the sample data for the specified dimension. If the data have only 1 dimension, such as "x", you do not need to specify the dimension.

Example

The following example returns the minimum and maximum x values in the data for fitting 1 independent variable, x:

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

x1, x2 = L:GetRangeX()

-- find the minimum and maximum x values

Printf("%lg,%lg\n", x1, x2 )

-- Result: -4.5, 18.7

 

Related Topics

CLsqFit class, GetRangeObs


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