Distance-based clustering of a set of XY coordinates

This function finds clusters in a set of spatial points expressed in XY coordinates.
1,2K Downloads
Aktualisiert 22 Okt 2019

Lizenz anzeigen

This function finds clusters in a set of spatial points expressed in XY coordinates. The clustering is based on the distance between the points and it does not require the number of clusters to be known beforehand. Each point is clustered with the closest neighbouring point if the distance between the two points is shorter than the user-defined
threshold.
The function outputs basic summary statistics (number of clusters, minimum, maximum and average cluster sizes, etc.) on the screen and figures showing the clusters, the centroid points and the geometric median points of each clusters. It also creates two text files that contain the coordinates of all centroid points and geometric median points. The output variables return, for every cluster, the XY coordinates of the centroid and of the geometric median point, as well as the XY coordinates of every point that form the cluster.

Usage:
--------
[clustersCentroids, clustersGeoMedians, clustersXY] = clusterXYpoints(inputfile, maxdist, minClusterSize, method, mergeflag);

Description of the input variables:
-----------------------------------------
- inputfile : Fullpath to text file with two columns: column 1 = X values, column 2 = Y values
- maxdist : Maximum distance between points for the clustering.
- minClusterSize : Minimum number of points per cluster.
- method : Determines the distance calculation method when adding points to an existing cluster. Possible methods are: 'point' (a point is added to an existing cluster if it is within a 'maxdist' distance of any point of the cluster), 'centroid' (a point is added to an existing cluster if it is within a 'maxdist' distance of the centroid of the cluster), and 'geometric median' (a point is added to an existing cluster if it is within a 'maxdist' distance of the geometric median point of the cluster). The default method is 'point'.
- mergeflag : If set to 'merge', then clusters that are within a 'maxdist' distance will be merged together. The distance calculation method is defined by the 'method' argument.

Zitieren als

Yann Marcon (2024). Distance-based clustering of a set of XY coordinates (https://www.mathworks.com/matlabcentral/fileexchange/56150-distance-based-clustering-of-a-set-of-xy-coordinates), MATLAB Central File Exchange. Abgerufen .

Kompatibilität der MATLAB-Version
Erstellt mit R2015b
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux
Kategorien
Mehr zu Numerical Integration and Differential Equations finden Sie in Help Center und MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Veröffentlicht Versionshinweise
1.5.0.0

Code made faster thanks to contribution from Carlos Ranz.

1.4.0.0

Fixed an exception when no cluster is found.

1.3.0.0

Added possibility to use different methods for the distance calculation.

1.2.0.0

Changed description.

1.1.0.0

Changed description.

1.0.0.0