How do you find the points where a line crosses over itself?

6 vues (au cours des 30 derniers jours)
Laura Berkowitz
Laura Berkowitz le 26 Sep 2017
Commenté : Laura Berkowitz le 27 Sep 2017
I have a set of XY coordinates and I need to identify the number and location of where the line intersects itself. I've plotted an example below.
The following code worked, but I'm concerned the thresholding input to unique tol may cause false positives.
[C,iz,ic]=uniquetol(Z,.03,'ByRows',true);
L=setdiff(Z,C,'rows','stable');
figure;plot(Z(:,1),Z(:,2));hold on; scatter(L(:,1),L(:,2))
For example, below is .03
And this was set at .04
The data were collected at the same frame rate, but the object being tracked exhibited variable velocity. Anyone have any idea how to determine threshold for a specific velocity? Or perhaps another method that is less error prone in general?
Any help/input is much appreciated!

Réponse acceptée

KSSV
KSSV le 27 Sep 2017
load XY.mat ;
x = A(:,1) ; y = A(:,2) ;
P = InterX([x y]') ;
plot(x,y,'b') ;
hold on
plot(P(1,:),P(2,:),'*r')

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by