distance between two points

6 vues (au cours des 30 derniers jours)
Guido Pastore
Guido Pastore le 15 Mar 2019
Commenté : Stephan le 15 Mar 2019
Hello,
given two double matrices of size (606x3), where each column indicates the XYZ coordinates of a point.
How can I calculate the distance between the two points ??

Réponse acceptée

Stephan
Stephan le 15 Mar 2019
dist = sqrt((A(:,1)-B(:,1)).^2 + (A(:,2)-B(:,2)).^2 + (A(:,3)-B(:,3)).^2);
  1 commentaire
Guido Pastore
Guido Pastore le 15 Mar 2019
Thank You so much

Connectez-vous pour commenter.

Plus de réponses (1)

Torsten
Torsten le 15 Mar 2019
Modifié(e) : Torsten le 15 Mar 2019
You mean "where each row indicates the XYZ coordinates of a point" ? And you want to calculate the distance between the corresponding points of the two matrices ?
dist = vecnorm(A-B,2,2)
  2 commentaires
Guido Pastore
Guido Pastore le 15 Mar 2019
Thank you so much
Stephan
Stephan le 15 Mar 2019
more smart solution

Connectez-vous pour commenter.

Catégories

En savoir plus sur NaNs dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by