calculate the distance between 2 points

조회 수: 77 (최근 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 CenterFile Exchange에서 Particle & Nuclear Physics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by