I have a n X 2 matrix, but I want remove the points with a distance smaller than a threshold. And the data is random, which means the data position may be very far in the matrix but their distance is very close. Can anyone help me?

4 vues (au cours des 30 derniers jours)
I have a n X 2 matrix, but I wanna remove the points with a distance smaller than a threshold. And the data is random, which means the data position may be very far in the matrix but their distance is very close. Can anyone help me with an algorithm to deal with it?
  3 commentaires
Jan Orwat
Jan Orwat le 7 Juin 2016
Modifié(e) : Jan Orwat le 7 Juin 2016
Distance between datapoints themselves I assume
binbin cui
binbin cui le 7 Juin 2016
The distance between any two points should be detected.

Connectez-vous pour commenter.

Réponse acceptée

Jan Orwat
Jan Orwat le 7 Juin 2016
dataOut = uniquetol(dataIn, tolerance, 'ByRows', true);
Above code should be a good starting point. In this case it would be 1-norm distance between points against given tolerance. Check uniquetol documentation for more information.
While it is not "Euklidean" 2-norm distance, in many cases should be good enough and it's very simple workaround.
  2 commentaires
binbin cui
binbin cui le 7 Juin 2016
Thank you very much. But I just find another algorithm to implement this calculation. I will use the D=pdist() to get all the possible distances.then find the values below the threshold in the D matrix. Use the index of target values to infer their pairing in original matrix.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Types 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