%% Histogram with Specified Normalization
% Generate 1,000 random numbers and create a histogram using the 'probability' normalization.

x = randn(1000,1);
h = histogram(x,'Normalization','probability')

%
% Compute the sum of the bar heights. With this normalization, the height of each bar is equal to the probability of selecting an observation within that bin interval, and the height of all of the bars sums to 1.

S = sum(h.Values)

% Copyright 2015 The MathWorks, Inc.