Finding closest point to known coordinates

조회 수: 3 (최근 30일)
Mehmet Volkan Ozdogan
Mehmet Volkan Ozdogan 2019년 3월 20일
댓글: Star Strider 2019년 3월 21일
Hi,
I want to find a coordinate which has minimum distance to other coordinates,
For example;
I want to find a coordinate (a,b) which has minimum distance to coordinates given below
x y
1 2
1 4
3 2
4 2

채택된 답변

Star Strider
Star Strider 2019년 3월 20일
The minimum distance of a set of points is the Centroid (link), defined as the mean of the coordinates of the points:
xy = [1 2
1 4
3 2
4 2];
minDist = mean(xy);
figure
plot(xy(:,1), xy(:,2), 'pg')
hold on
plot(minDist(1), minDist(2), 'rp')
hold off
grid
axis equal
Experiment toi get the result you want.
  댓글 수: 6
Mehmet Volkan Ozdogan
Mehmet Volkan Ozdogan 2019년 3월 21일
Thank you again
Sincerely
Star Strider
Star Strider 2019년 3월 21일
As always, my pleasure.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by