calculate the distance between 2 points
47 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
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 个评论
更多回答(1 个)
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].
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Mapping Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!