function hist2(y,nc)

% hist2(y,m)
%
% Plots a histogram of the relative frequencies of the elements in y,
% such that the area under the histogram is 1.
% The number of bins is m.

n = length(y);
[yy,xx] = hist(y,nc);
w = (max(y)-min(y))/nc;
bar(xx,yy/(n*w))
title('Normerat histogram')
xlabel('Data')
ylabel('Relativ frekvens / klassbredd')
