gaussdev list

hist (replaces THistogram)


The hist function returns a table containing the histogram of an array using default binning parameters. It does not return a CHistogram object. If a plotted histogram is desired, you could also use the histplot function which reveals the abscissa values on the plotted x-axis. For computing a histogram with complete access to the input data and binning parameters, use the CHistogram class.

Syntax

histogram_table = hist( tbl )

bullet.gif    tbl is the 1-dimensional array of sample points.

bullet.gif    histogram_table is returned as a 1-dimensional array containing the histogram frequencies.

bullet.gif    On failure, nil is returned.

Remarks

This function expedites histogram calculation when you do not need to set specific histogramming parameters. The function uses the default settings of the CHistogram class, which include a bin count of the lesser of the square root of the number of sample points and 100.

Example

The following script computes and plots a histogram of 1 million Gaussian random numbers. In the script, note that the # operator returns the number of table elements.

h = hist( gaussdev(1000000) )

-- return a table with a histogram of gaussian deviates

x = series( #h )

-- create an x axis

stepline( x, h )

-- make a step-line plot showing a nice Gaussian curve

Related Topics

CHistogram Class

histplot

Table and Array Functions

series

gaussdev

stepline

 

 


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