%% Normalized Bin Counts
% Distribute 1,000 pairs of random numbers into bins. Specify Normalization as 'probability' to normalize the bin counts such that sum(N(:)) is 1. That is, each bin count represents the probability that an observation falls within that bin.

x = randn(1000,1);
y = randn(1000,1);
[N,Xedges,Yedges] = histcounts2(x,y,6,'Normalization','probability')

% Copyright 2015 The MathWorks, Inc.