histogram calculates the histogram of a vector.
Return Value
rmXY is a matrix with two columns. Column 1 contains the bin center values and column 2 the number of points in each bin. If hLayer is specified and greater of equal zero the function returns the handle of a dataset.
Parameters
rmY is a real matrix. The last matrix column is used to calculate the histogram.
bins is a scalar value with the number of bins or a vector with bin limits or center points Default value is 10.
nType sets the type of histogram:
| Typ | Description |
|---|---|
| nType = 1 | Absolute |
| nType = 2 | Percent |
| nType = 3 | cumulative (more than) |
| nType = 4 | cumulative in Percent (more than) |
| nType = 5 | cumulative (less than) |
| nType = 6 | cumulative in Percent (less than) |
Default value is 1.
If bCenterBin is TRUE (1), the values in bin are treated as center points If bCenterBin is FALSE (0), the values in bin are treated as class limits. Default value is FALSE; Example for bCenterBin = TRUE: bins: 2,4,6,8 Bins: 1 to 3, 3 to 5, 5 to7, 7 to 9 Example for bCenterBin = FALSE: bins: 2,4,6,8 Bins: 2 to 4, 4 to 6, 6 to 8
If hLayer is 0, an new diagram with the plot is created. If hLayer is greater 0, the histogram plot is added to the layer hLayer. For both cases the function returns the dataset handle in the parameter rmXY. If hLayer is -1 the function does not create a plot. Default value is -1;
Example
* srand(0)
1.0000
* histogram(rand(10,1), 0:0.1:1, 1, TRUE)
0.0000 0.0000
0.1000 0.0000
0.2000 2.0000
0.3000 1.0000
0.4000 0.0000
0.5000 0.0000
0.6000 1.0000
0.7000 2.0000
0.8000 3.0000
0.9000 1.0000
1.0000 0.0000
* srand(0)
1.0000
* histogram(rand(10,1), 0:0.1:1, 1, FALSE)
0.0500 0.0000
0.1500 1.0000
0.2500 2.0000
0.3500 0.0000
0.4500 0.0000
0.5500 1.0000
0.6500 1.0000
0.7500 1.0000
0.8500 4.0000
0.9500 0.0000
History
| Version | Description |
|---|---|
| 5.10.2 | New Types: 5 cumulative (less than) and 6 cumulative in Percent (less than) added. |
| 5.3.0 | New. |
See also
id-694203