distance between two vertices
1 次查看(过去 30 天)
显示 更早的评论
How I can compute the distance between two vertices (point)
vertex1 = (x,y,z) vertex2 = (x,y,z)
0 个评论
回答(2 个)
Andrei Bobrov
2012-4-19
Pythagorean
d = sqrt(sum((vertex1-vertex2).^2))
hypot()
k = vertex1-vertex2;
d = hypot(hypot(k(1),k(2)),k(3));
use norm()
d = norm(vertex1-vertex2,2);
use dist from Neural Network Toolbox
d = dist([vertex1;vertex2]')
use pdist from Statistics Toolbox
d = pdist([vertex1;vertex2])
1 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Statistics and Machine Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!