N-Dimensional Histogram Count

Version 1.5.0.0 (2,46 KB) von Mathew
Bins the elements of n matrices into an n-dimensional histogram.
986 Downloads
Aktualisiert 2. Dez 2010

Lizenz anzeigen

HISTCND is similar to HISTC, but creates a histogram with any number of dimensions.

N = HISTCND(X,Y,Z,... XEDGES,YEDGES,ZEDGES,... )

where N is a histogram count with dimensions
length(XEDGES) x length(YEDGES) x length(ZEDGES) ...

If XEDGES, YEDGES, etc. are monotonically increasing and non-NaN, a data point is assigned to bin N(i,j,k,...) if

XEDGES(i) <= X < XEDGES(i+1)

YEDGES(j) <= Y < YEDGES(j+1)

ZEDGES(k) <= Z < ZEDGES(k+1)

....

Note: data outside the ranges of the EDGES vectors are excluded from the histogram, and not placed in the first or last bins.

An example:

x=rand(100,100);
y=rand(100,100);
xedges=0:0.01:1;
yedges=0:0.1:1;

n=histcnd(x,y,xedges,yedges);

pcolor(xedges,yedges,n');
colorbar;

Zitieren als

Mathew (2024). N-Dimensional Histogram Count (https://www.mathworks.com/matlabcentral/fileexchange/29435-n-dimensional-histogram-count), MATLAB Central File Exchange. Abgerufen .

Kompatibilität der MATLAB-Version
Erstellt mit R2006b
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux
Kategorien
Mehr zu Histograms finden Sie in Help Center und MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Veröffentlicht Versionshinweise
1.5.0.0

Bug Fix: the behaviour is now consistent for data above and below ranges of the edges vectors.

1.3.0.0

Added comments to explain the algorithm. Small optimization of code.

1.2.0.0

Added an example to the description.

1.0.0.0