www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/BinCountsAndBinEdgesBivariateExample.m

    %% Bin Counts and Bin Edges
% Distribute 100 pairs of random numbers into bins. |histcounts2|
% automatically chooses an appropriate bin width to reveal the underlying
% distribution of the data.

% Copyright 2015 The MathWorks, Inc.

x = randn(100,1);
y = randn(100,1);
[N,Xedges,Yedges] = histcounts2(x,y)