hist¶
Purpose¶
Computes and graphs a frequency histogram for a vector. The actual frequencies are plotted for each category.
Note
this function is for use with the deprecated PQG graphics. Use plotHist()
instead.
Library¶
pgraph
Format¶

{ b, m, freq } =
hist
(x, v)¶ Parameters:  x (Mx1 vector) – data
 v (Nx1 vector or scalar) – the breakpoints to be used to compute the frequencies (vector) or the number of categories (scalar).
Returns:  b (Px1 vector) – the breakpoints used for each category.
 m (Px1 vector) – the midpoints of each category.
 freq (Px1 vector) – computed frequency counts.
Examples¶
library pgraph;
x = rndn(5000,1);
{ b, m, f } = hist(x, 20);
Remarks¶
If a vector of breakpoints is specified, a final breakpoint equal to the maximum value of x will be added if the maximum breakpoint value is smaller.
If a number of categories is specified, the data will be divided into v evenly spaced categories.
Each time an element falls into one of the categories specified in b, the corresponding element of freq will be incremented by one. The categories are interpreted as follows:
freq[1] = x < b[1]
freq[2] = b[1] < x < b[2]
freq[3] = b[2] < x < b[3]
.
.
.
freq[P] = b[P1] < x < b[P]