CStats:SdevValue
The SdevValue method computes the Standard Deviation of a data sample using a mean value which is supplied, rather than calculated. The sample may be a Lua table or a class object of type CImage, CArray, or CMatrix. For CImage and CMatrix objects, an optional CRect object can be used to define the points used in the calculation.
nStdDev = CStats:SdevValue( table, nValue ) nStdDev = CStats:SdevValue( CImage, nValue ) nStdDev = CStats:SdevValue( CImage, nValue, CRect ) nStdDev = CStats:SdevValue( CArray, nValue ) nStdDev = CStats:SdevValue( CArray, nValue, CRect ) nStdDev = CStats:SdevValue( CMatrix, nValue ) where |
table is a lua table containing the data.
CImage, CArray, and CMatrix are class objects containing the data to measure,
CRect is a CRect rectangle object that defines the region to measure.
nValue is the value about which to calculate the standard deviation.
nStdDev is the standard deviation of the data. On failure, 0 is returned.
The following script returns the standard deviation relative to a specified mean value::
|
-- create a CStats object |
|
-- set the target mean value |
|
-- return the standard deviation relative to nMean |
|
-- list the results |
The following script returns the standard deviation for a table of data relative to a mean value of 1.54:
|
-- create a CStats object |
|
-- create some data in a table |
|
-- list the result |