MATLAB Function Reference |
histogram
Compute a histogram
Syntax
[result,descriptor] = histogram(x) [result,descriptor] = histogram(x,descriptor)
Description
The discriptor
describes the cells of the histogram. The
discriptor
consists of three elements
[lower,upper,ncell]
. The default values are
lower=min(x)-delta/2
, upper=max(x)+delta/2
and
ncell=ceil(sqrt(length(x)))
, where delta=(max(x)-min(x))/(length(x)-1)
.
Its assumed that lower < upper
and
ncell >= 1
. Futhermore its assumed that x
is a row
vector.
The result
is a row vector containing the histogram of x
.
The index of the histogram cells is computed by index = round( (x(i)-lower) / (upper-lower) * ncell
) + 1/2
. If the index is out of the range 1 <= index <=
ncell
, consequently x(i) < lower
or upper <= x(i)
, the element of x(i)
is
excluded from the histogram.
See Also
Literature
None
Source code
MATLAB Function Reference |