필터 지우기
필터 지우기

standard euclidean distance, matlab

조회 수: 3 (최근 30일)
Tomas
Tomas 2014년 2월 5일
댓글: Walter Roberson 2014년 2월 6일
Helllo
I need help with standard euclidean distance, knew would someone help with matlab code ?
I can not use, matlab function, pdist, pdist2.
I need standard euclidean distance between two vectors.
Thanks.

답변 (1개)

Walter Roberson
Walter Roberson 2014년 2월 5일
sqrt(sum((v1 - v2).^2))
  댓글 수: 6
Tomas
Tomas 2014년 2월 5일
if it were arrays, how would it be?
Thank you for your help
Walter Roberson
Walter Roberson 2014년 2월 6일
sqrt(sum((A1 ./ repmat(nanstd(A1), size(A1,1), 1) - A2 ./ repmat(nanstd(A2), size(A2,1), 1)).^2, 2))
This would be for taking the distance for the rows of A1 to the corresponding rows of A2.
I am thinking that possibly it should be different, like this:
sqrt(sum(((A1-A2) ./ repmat( nanstd([A1;A2]), size(A1,1), 1)).^2,2))

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by