Matlab: Centroid of a cluster of points

Join the discussion
Registration is free. Start your own thread to ask a follow-up.
1 reply · 39K views
babistopher
Messages
15
Reaction score
0
I have collected and plotted thousands of data points and would like to now find where the center of this "data cloud" lies. I was wondering if anybody had an idea as to how I could approach this in Matlab. Thanks in advance.
 
Physics news on Phys.org
Assuming that your positions are labeled by vectors (e.g., a column matrices)...
and that these positions are to be equally weighted,
simply add up all of vectors, then divide by the number of vectors
... that is, a straight average.

With MATLAB, there is probably a way to efficiently compute the sum of an array of vectors.
"sum" http://www.mathworks.com/access/hel...ml?/access/helpdesk/help/techdoc/ref/sum.html