# 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.

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 =          x < b
freq = b   < x < b
freq = b   < x < b
.
.
.
freq[P] = b[P-1] < x < b[P]


phist.src