필터 지우기
필터 지우기

distance between two points

조회 수: 2 (최근 30일)
Guido Pastore
Guido Pastore 2019년 3월 15일
댓글: Stephan 2019년 3월 15일
Hello,
given two double matrices of size (606x3), where each column indicates the XYZ coordinates of a point.
How can I calculate the distance between the two points ??

채택된 답변

Stephan
Stephan 2019년 3월 15일
dist = sqrt((A(:,1)-B(:,1)).^2 + (A(:,2)-B(:,2)).^2 + (A(:,3)-B(:,3)).^2);

추가 답변 (1개)

Torsten
Torsten 2019년 3월 15일
편집: Torsten 2019년 3월 15일
You mean "where each row indicates the XYZ coordinates of a point" ? And you want to calculate the distance between the corresponding points of the two matrices ?
dist = vecnorm(A-B,2,2)
  댓글 수: 2
Guido Pastore
Guido Pastore 2019년 3월 15일
Thank you so much
Stephan
Stephan 2019년 3월 15일
more smart solution

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

카테고리

Help CenterFile Exchange에서 NaNs에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by