-
Notifications
You must be signed in to change notification settings - Fork 9
histogram
Computes a histogram that shows the distribution of data values.
Bins the elements in vector Y into 10 equally spaced containers and outputs the number of elements in each container in a row vector. If Y is an m-by-p matrix, histogram treats the columns of Y as vectors and outputs a 10-by-p matrix n. Each column of n contains the results for the corresponding column of Y. No elements of Y can be complex or of type integer.
Argument Y
Matrix
Returns 1. entry
Matrix
histogram(rand(100, 1))
Places 100 uniformly generated random numbers into 10 bins with a spacing that should be approximately 0.1.
Here x is a vector, such that the distribution of Y among length(x) bins with centers specified by x. For example, if x is a 5-element vector, histogram distributes the elements of Y into five bins centered on the x-axis at the elements in x, none of which can be complex.
Argument Y
Matrix
Argument x
Matrix
Returns 1. entry
Matrix
histogram(rand(100, 1), [0.1, 0.5, 0.9])
Places 100 uniformly generated random numbers into 3 bins that center around 0.1, 0.5 and 0.9.
Bins the elements in vector Y into nbins equally spaced containers and outputs the number of elements as before.
Argument Y
Matrix
Argument nbins
Scalar
Returns 1. entry
Matrix
histogram(rand(100, 1), 20)
Places 100 uniformly generated random numbers into 20 bins with a spacing that should be approximately 0.05.