Finding closest point to known coordinates

1 vue (au cours des 30 derniers jours)
Mehmet Volkan Ozdogan
Mehmet Volkan Ozdogan le 20 Mar 2019
Commenté : Star Strider le 21 Mar 2019
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
  1 commentaire
Stephan
Stephan le 20 Mar 2019
euclidian distance?

Connectez-vous pour commenter.

Réponse acceptée

Star Strider
Star Strider le 20 Mar 2019
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 commentaires
Mehmet Volkan Ozdogan
Mehmet Volkan Ozdogan le 21 Mar 2019
Thank you again
Sincerely
Star Strider
Star Strider le 21 Mar 2019
As always, my pleasure.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by