% Demonstration of use of Matlab 'hist' command for making histograms.

% This example generates nrandom random numbers between 1 and imax, 
% then makes a histogram of the frequency counts (i.e. using imax bins
% for the histogram).

% Generate row vector of random numbers.
nrandom = 10000;
imax = 20;
vrandom = randi(imax,1,nrandom);

% Make histogram.
hist(vrandom,imax);
title('Histogram of frequency counts for 10000 random integers between 1 and 20');
xlabel('Integer');
ylabel('Count');
