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!