basic question on how to find mean distance between an interior point and all of the vertex points of the convex hull
1 回表示 (過去 30 日間)
古いコメントを表示
Hi,
I know how to get the convex hull of a set of 3 dimensional points:
% Create the data.
n = 50;
X = randn(n,3);
% Plot the points.
plot3(X(:,1),X(:,2),X(:,3),'ko','markerfacecolor','k');
% Compute the convex hull.
C = convhulln(X);
I have certain interior base locations and I want to determine the average (mean) distance between the base location and all other points on the vertex of the convex hull. How do I do this easily? Thank you for your time
Andrew
0 件のコメント
回答 (1 件)
Laurens Bakker
2012 年 3 月 7 日
Hi Andrew,
If you have the Statistics toolbox, use the pdist function to compute the distance between a vector of points and a single point. Otherwise, do it by hand:
P = unique( C, 'rows' );
dist = sqrt(sum( bsxfun(@minus,P,yourBaseLocation) .^ 2, 2 ));
I used Euclidean distance: sqrt(sum( (A - B)^2 ))
Cheers,
Laurens
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Bounding Regions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!