2D data with equal bin count

2 views (last 30 days)
Adam Calvetti
Adam Calvetti on 7 Oct 2017
Edited: Cedric on 7 Oct 2017
I need to divide up a 2D surface containing 20,000,000 points into multiple segments (eg 100) such that each 2D segment contains an equal amount of points. I have looked into histogram bin widths, but cannot seem to correctly manipulate it.
EDIT Cedric: including the comment below
I should have specified in the question, I am using a triangular mesh initially defined by the delaunay function across a set of equally spaced grid points, using inpolygon I find the number of points within a segment and alter the locations of the segment nodes. The code is run until convergence to a density range.
I hoped there would be some form of code or functions around to deal with this situation or a form of dynamic gridding.
  2 Comments
Cedric
Cedric on 7 Oct 2017
Edited: Cedric on 7 Oct 2017
There is likely no regular rectangular binning geometry that can satisfy what you are asking for, unless the points are almost perfectly homogeneously distributed (or if there are fluctuations in the density of points but only in one direction). Draw a rectangle on a sheet of paper, place randomly 10 points, and you will see that you will likely not be able to find a rectangular grid that has the property that you are asking for.
You can likely find some triangular mesh or rectangular multi-scale grid designed for that purpose though, but at least for the rectangular multi-scale grid there will not be a strictly equal amount of points in each cell (and it is not binning as people usually define it, and it requires quite a bit of work).
Adam Calvetti
Adam Calvetti on 7 Oct 2017
I should have specified in the question, I am using a triangular mesh initially defined by the delaunay function across a set of equally spaced grid points, using inpolygon I find the number of points within a segment and alter the locations of the segment nodes. The code is run until convergence to a density range.
I hoped there would be some form of code or functions around to deal with this situation or a form of dynamic gridding.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!