% Example 9.1
% This illustrates the 1-D histogram using
% relative frequency and frequency.

load galaxy
% The 'hist' function can return the
% bin centers and frequencies.
% Use the default number of bins - 10.
[n, x] = hist(EastWest);
% Plot and use the argument of width = 1
% to get bars that touch.
bar(x,n,1,'w');
title('Frequency Histogram - Galaxy Data')
xlabel('Velocity')
ylabel('Frequency')


% Now create a relative frequency histogram.
% Divide each box by the total number of points.
bar (x,n/140,1,'w')
title('Relative Frequency Histogram - Galaxy Data')
xlabel('Velocity')
ylabel('Relative Frequency')
