1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matlab: Centroid of a cluster of points

  1. Nov 30, 2007 #1
    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.
     
  2. jcsd
  3. Nov 30, 2007 #2

    robphy

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    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
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Matlab: Centroid of a cluster of points
Loading...