calculate the distance between 2 points

79 ビュー (過去 30 日間)
Majid Al-Sirafi
Majid Al-Sirafi 2012 年 3 月 22 日
コメント済み: jaafar rashid 2023 年 11 月 11 日
hi every one i want to calculate the distance between 2 points(p1 & p2), so which of the following equation choose to do that:-
d = (x(p1)-x(p2))^2+(y(p1)-y(p2))^2;
or
d = sqrt((x(p1)-x(p2))^2+(y(p1)-y(p2))^2);
or any one from the above equations
thanks

採用された回答

Grzegorz Knor
Grzegorz Knor 2012 年 3 月 22 日
The common use distance formula is the second one:
d = sqrt((x(p1)-x(p2))^2+(y(p1)-y(p2))^2);
  11 件のコメント
Daniel Shub
Daniel Shub 2012 年 3 月 25 日
@majid, but in what direction?
Majid Al-Sirafi
Majid Al-Sirafi 2012 年 3 月 25 日
one point to the left and another to the right

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

その他の回答 (1 件)

Jan
Jan 2012 年 3 月 22 日
You can simply try it, if you are not familiar with the Euclidean Norm (hint: use this term to ask Google or WikiPedia):
Set the variables to coordinates, whichj have a known distance, e.g. [0,0] and [2,0].
  1 件のコメント
jaafar rashid
jaafar rashid 2023 年 11 月 11 日
are they norme and ecludian same??

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

カテゴリ

Help Center および File ExchangeParticle & Nuclear Physics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by