2D Histogram Matrix

Returns a matrix of number of points in each bins defined by two vectors.
13,1K descargas
Actualizado 18 jul 2006

Sin licencia

Nota del editor: 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

Citar como

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

Compatibilidad con la versión de MATLAB
Se creó con R11.1
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux
Categorías
Más información sobre Histograms en Help Center y MATLAB Answers.
Agradecimientos

Inspiración para: 2-Dimensional Histogram

Community Treasure Hunt

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

Start Hunting!
Versión Publicado Notas de la versión
1.0.0.0

Code cleaning