Computing Euclidean distance between 2 points
1 回表示 (過去 30 日間)
古いコメントを表示
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?

0 件のコメント
採用された回答
その他の回答 (1 件)
Bruno Luong
2022 年 5 月 3 日
編集済み: Bruno Luong
2022 年 5 月 3 日
For a row vector d
% sum(d.^2)
is equal to
% d*d'
Example
d=randi(10,1,3)
sum(d.^2)
d*d'
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Ordinary Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!