Counts in each bin for 2d histogram ?
15 ビュー (過去 30 日間)
古いコメントを表示
I have two vectors X and Y. To construct a 2D histogram, I have to create a grid on scatter plot of X,Y. And count number of data points in each small square of the grid that will be my frequency. Can someone help me how to decide number of bins and any matlab function to count the frequency in each small square ?
0 件のコメント
回答 (1 件)
Stephen23
2016 年 2 月 4 日
5 件のコメント
Steven Lord
2017 年 12 月 14 日
If you want to see a 2-dimensional histogram plot, use histogram2 instead of histcounts2. The interfaces of those two functions are very similar, but the intent of the histcounts2 function is to let you bin the data without plotting anything. In histogram2, the ouput is the graphics object.
Image Analyst
2017 年 12 月 14 日
histogram2() gives an object with lots of info, if you choose to accept it:
x = randn(1000,1);
y = randn(1000,1);
h = histogram2(x,y)
h =
Histogram2 with properties:
Data: [1000×2 double]
Values: [13×13 double]
NumBins: [13 13]
XBinEdges: [-3.5 -3 -2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3]
YBinEdges: [-3.5 -3 -2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3]
BinWidth: [0.5 0.5]
Normalization: 'count'
FaceColor: 'auto'
EdgeColor: [0.15 0.15 0.15]
plus more...
参考
カテゴリ
Help Center および File Exchange で Data Distribution Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!