how to find the weighted centroid, center of mass/barycenter of a 3D grid of points

19 ビュー (過去 30 日間)
Octavian
Octavian 2014 年 10 月 30 日
コメント済み: Octavian 2014 年 10 月 31 日
Dear all, I am new to matlab, I need to find the coordinates of the center of mass of a regular 3D grid of points, each point being weighted by an intensity value v. I have the 3D grid as a 2D matrix A, with rows A(k,:)= [xk, yk, zk, vk], where xk, yk, zk, are the coordinates of the point k, and vk is its intensity (current amplitude in my case, I am working with source imaging). I mention that the hull of the 3d grid is concave or convex at times, actually the cortical surface, with the points placed within the brain substance regularly; and the barycenter cannot be but one these 3D grid points (it cannot be, for example, outside the brain bounded by a concave surface such as a sulcus). I know this may be trivial, I appreciate your help. Tavi

採用された回答

Niko
Niko 2014 年 10 月 30 日
sum(bsxfun(@times,A(:,1:3),A(:,4)),1)/sum(A(:,4))
Not sure if this is what you're looking for...
  1 件のコメント
Octavian
Octavian 2014 年 10 月 31 日
Thank you, Niko, this is close, however the result is not constrained to the 3D grid points, I would need to find the point of the grid in A closest to the calculated barycenter per your formula, and find its index k. Octavian

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeBounding Regions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by