distance between two points

6 ビュー (過去 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 件のコメント
Guido Pastore
Guido Pastore 2019 年 3 月 15 日
Thank You so much

サインインしてコメントする。

その他の回答 (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

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by