Extract center of the bin while 3D binning
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Taking it forward from here... https://www.mathworks.com/matlabcentral/answers/293645-how-to-sort-3d-data-into-bins
I have a set of xyz and corresponding "u" values for 3D binning. This is what I use to bin the variable u as shown below. Now from what I've understood, the binning takes place using bin edges. I would also like to find the center of each bin where the datapoints fall into. Ideally I want to have another variable which would store the bin-center values in the same format as the output U in this case.
xbins=min(x):binsize:max(x);
ybins=min(y):binsize:max(y);
zbins=min(z):binsize:max(z);
[~,~,cx]=histcounts(x,xbins);
[~,~,cy]=histcounts(y,ybins);
[~,~,cz]=histcounts(z,zbins); % generates indices for each direction.
U = accumarray([cx, cy, cz], u(:),[],@(vals){vals}, {});
Any help is appreciated.
Thanks!
0 comentarios
Respuestas (1)
Sai Bhargav Avula
el 18 de Feb. de 2020
Hi,
Assuming the exact center meaning the center of the dataset in the bin, the center can be estimated by finding mean of all the points in the mean(this is the centroid of the bin).
But if you mean the geometric center of the bin it is impossible to estimate to the best of my knowledge as there is not definite boundary of the boundary as the binning is done by thresholding.
Hope this helps!
0 comentarios
Ver también
Categorías
Más información sobre Hypothesis Tests en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!