hist
Histogram plot.
Syntax
hist(x)
hist(x, nbins)
hist(ax, ...)
counts = hist(...)
[counts, centers] = hist(...)
Input argument
x - vector or matrix
nbins - vector.
ax - Axes object.
Output argument
counts - Counts of the number of elements in each bin: row vector.
centers - Bin centers: vector.
Description
A histogram is a graphical representation that illustrates the distribution of data values.
When you use the hist function, it organizes the elements in the vector Y into 10 equally spaced containers and provides the count of elements in each container as a row vector.
hist(Y, x) with a vector x, the function will return the distribution of values in Y among bins determined by the length of x, with centers specified by the values in x.
For instance, if x is a 5-element vector, hist will categorize the elements of Y into five bins, each centered on the x-axis at the values specified in x.
When you use hist(...) without specifying any output arguments, it generates a histogram plot. The bins are distributed along the x-axis between the minimum and maximum values found in the input vector Y.
Example
See also
History
Author
Allan CORNET
Last updated