www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/SpecifyBinEdgesBivariateExample.m
%% Specify Bin Edges % Distribute 1,000 pairs of random numbers into bins. Define the bin edges % with two vectors: one each for the x and y dimensions. The first element % in each vector specifies the first edge of the first bin, and the last % element is the last edge of the last bin. % Copyright 2015 The MathWorks, Inc. x = randn(1000,1); y = randn(1000,1); Xedges = -5:5; Yedges = [-5 -4 -2 -1 -0.5 0 0.5 1 2 4 5]; N = histcounts2(x,y,Xedges,Yedges)