2D Histogram Matrix

版本 1.0.0.0 (1.2 KB) 作者: Kangwon Lee
Returns a matrix of number of points in each bins defined by two vectors.
13.1K 次下载
更新时间 2006/7/18

无许可证

编者注: This file was selected as MATLAB Central Pick of the Week

function mHist = hist2d ([vY, vX], vYEdge, vXEdge)
2 Dimensional Histogram
Counts number of points in the bins defined by vYEdge, vXEdge.
size(vX) == size(vY) == [n,1]
size(mHist) == [length(vYEdge) -1, length(vXEdge) -1]

EXAMPLE

mYX = rand(100,2);
vXEdge = linspace(0,1,10);
vYEdge = linspace(0,1,20);
mHist2d = hist2d(mYX,vYEdge,vXEdge);

nXBins = length(vXEdge);
nYBins = length(vYEdge);
vXLabel = 0.5*(vXEdge(1:(nXBins-1))+vXEdge(2:nXBins));
vYLabel = 0.5*(vYEdge(1:(nYBins-1))+vYEdge(2:nYBins));
pcolor(vXLabel, vYLabel,mHist2d); colorbar

引用格式

Kangwon Lee (2024). 2D Histogram Matrix (https://www.mathworks.com/matlabcentral/fileexchange/1487-2d-histogram-matrix), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R11.1
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Histograms 的更多信息
致谢

启发作品: 2-Dimensional Histogram

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0

Code cleaning