Computing Euclidean distance between 2 points
古いコメントを表示
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?

採用された回答
その他の回答 (1 件)
For a row vector d
% sum(d.^2)
is equal to
% d*d'
Example
d=randi(10,1,3)
sum(d.^2)
d*d'
カテゴリ
ヘルプ センター および File Exchange で Computational Geometry についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!