File Exchange

image thumbnail

N-Dimensional and Circular Histogram Counts

version 1.1.0.0 (4.51 KB) by Paul
Compute n-dimensional histogram counts, also supports circular dimensions.

3 Downloads

Updated 05 Apr 2015

View License

Given a set of n-dimensional vectors and an n-dimensional histogram, compute the number of vectors that fall into each bin. The histogram is given as rectilinear grid (i.e. the bins can vary in size along each dimension). Dimensions can also be marked as circular to create polar or cylindrical grids or their generalizations. The input vector format must match the grid, for example, if a polar grid is used, the input vectors must be given in polar coordinates. Coordinates are not converted in the function.
Example:

load clown;
[y,x] = find(X>max(X(:))*0.5);
[a,r] = cart2pol(x-size(X,2)/2,y-size(X,1)/2);
abinedges = linspace(0,2*pi,65);
abinedges(end) = [];
rbinedges = log10(logspace(0,1,65)).*(size(X,2)/2);
c = histcountsn([a,r],{abinedges,rbinedges},[true,false]);

Comments and Ratings (1)

Updates

1.1.0.0

fixed title

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired by: 2D Histogram Calculation