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 visualizaciones (últimos 30 días)
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 comentarios
Jan Orwat
Jan Orwat el 7 de Jun. de 2016
Editada: Jan Orwat el 7 de Jun. de 2016
Distance between datapoints themselves I assume

Iniciar sesión para comentar.

Respuesta aceptada

Jan Orwat
Jan Orwat el 7 de Jun. de 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 comentarios
binbin cui
binbin cui el 7 de Jun. de 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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Types en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by