Sorting coordinates on radial distance from origin
Mostrar comentarios más antiguos
Very new to MatLab and struggling with what I think is probably very easy.
I have a set of x,y coordinates over time from particle tracking analysis. I would like to set the origin to a specific x,y coordinate and then calculate the number of coordinates that are some given radial distance from this origin.
Any help greatly appreciated!
Respuesta aceptada
Más respuestas (1)
Matt J
el 9 de Jun. de 2022
Editada: James Tursa
el 9 de Jun. de 2022
Here's one way to do that:
[~,distance] = cart2pol(x-x0,y-y0); %distances from (x0,y0)
count = nnz(dist_Lower<=distance & distance<=dist_Upper) % count the number within a certain distance range
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!