sdevn
The sdevn function returns the standard deviation of a general lua table that may contain a multi-dimensional array or a mixture of numbers, strings, named keys, and sub-tables. Only numeric values found in the table are used in the calculation. The related sdev function calculates the mean of a 1-dimensional array, CImage, or list of numbers. Since an array is a specific type of table that contains only numbers or sub-tables, this function can also be used for arrays.
nStdDev = sdevn( tbl )
tbl is a general lua table.
nStdDev is the standard deviation of the values.
The following script returns the standard deviation of a table containing 1 million random numbers.
|
-- create a table of numbers |
|
-- find the standard deviation |
|
-- list the result |
The next example computes the standard deviation of an ugly, complex table:
|
|
|
-- find the standard deviation |
|
-- result: Sdev = 6.97615 using 4 values |
Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024
Mirametrics, Inc. All Rights Reserved.