Computing Euclidean distance between 2 points
Afficher commentaires plus anciens
I found a code computing Euclidean distance as
diff = q - p;
dist = sqrt(diff * diff');
is there any difference from the standard Euclidean distance formula, why transpose is taken?

Réponse acceptée
Plus de réponses (1)
Bruno Luong
le 3 Mai 2022
Modifié(e) : Bruno Luong
le 3 Mai 2022
For a row vector d
% sum(d.^2)
is equal to
% d*d'
Example
d=randi(10,1,3)
sum(d.^2)
d*d'
Catégories
En savoir plus sur Computational Geometry dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!