Distance betwen 3d points

2 次查看(过去 30 天)
Pablo Doval
Pablo Doval 2020-3-3
So basically I have an aray of points, of length 14, with coordinates x, y and z. And I have an array of connections, defining the connections of the points I want to calculate the distance. How would you do it? I have tried to do it with nested for loops but can't seem to get the hang of it.
something like this
% Connectivity
Con = [1 2; 3 4; 5 6; 7 8; 9 10; 11 12; 13 14; 1 3; 3 5; 5 7; 7 9; 9 11; 11 13; 2 4; 4 6; 6 8; 8 10; 10 12; 12 14; 2 3; 4 5; 6 7; 7 10; 9 12; 11 14];
% Nodal Coordinates
Coord = [0 2500 0; 0 3750 0; 1340 3040 0; 1340 4290 0; 2670 3530 0; 2670 4780 0; 4000 3700 0; 4000 4950 0; 5330 3530 0; 5330 4780 0; 6660 3040 0; 6660 4290 0; 8000 2500 0; 8000 3750 0];

回答(1 个)

Rik
Rik 2020-3-3
If you have the statistics toolbox you can use pdist2.
  3 个评论
Image Analyst
Image Analyst 2020-3-3
How about sqrt() or norm()?
Pablo Doval
Pablo Doval 2020-3-3
wait sorry, we can use any toolboxes, so pdist, sqrt or norm can be used

请先登录,再进行评论。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by