Distance betwen 3d points

3 visualizzazioni (ultimi 30 giorni)
Pablo Doval
Pablo Doval il 3 Mar 2020
Commentato: Pablo Doval il 3 Mar 2020
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];

Risposte (1)

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

Accedi per commentare.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by