As i've explained in a previous question: I have a dataset consisting of a large semi-random collection of points in three dimensional euclidian space. In this collection of points, i am trying to find the point that is closest to the area with the highest density of points.
As high performance mark answered;
the most straightforward thing to do would be to divide your subset of Euclidean space into lots of little unit volumes (voxels) and count how many points there are in each one. The voxel with the most points is where the density of points is at its highest. Perhaps initially dividing your space into 2 x 2 x 2 voxels, then choosing the voxel with most points and sub-dividing that in turn until your criteria are satisfied.
Mark suggested i use triplequad
for this, but this is not a function i am familiar with, or understand very well. Does anyone have any pointers on how i could go about using this function in Matlab for what i am trying to do?
For example, say i have a random normally distributed matrix A = randn([300,300,300])
, how could i use triplequad
to find the point i am looking for? Because as i understand currently, i also have to provide triplequad
with a function fun
when using it. Which function should that be for this problem?