Distance betwen 3d points

3 visualizaciones (últimos 30 días)
Pablo Doval
Pablo Doval el 3 de Mzo. de 2020
Comentada: Pablo Doval el 3 de Mzo. de 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];

Respuestas (1)

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

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by