FUNCTION REFERENCE

hist

Histogram bin counts.

Histogram bin counts.

Syntax

n = hist(y)

Syntax

n = hist(y, nbins)

Syntax

n = hist(y, centers)

Syntax

[n, c] = hist(...)

Counts y in nbins (default 10) equally spaced bins between min(y) and

max(y), or in bins around the given centers. A value on the boundary

between two bins goes to the lower bin. For a matrix each column is binned

separately and n has one column per column of y. c returns the bin centers.

Example

n = hist([1 2 2 3 3 3], 3)   % [1 2 3]

Differences from MATLAB: hist with no output argument draws a bar chart in

MATLAB; here it stops with an error ("plotting is not supported yet").

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.