Intersection of Discretized Curves
Afficher commentaires plus anciens
Hi,
I have a scatter plot of two curves.
The curves intersect each other and ideally they should have one or more intersection points.
However, as I have discrete points and two curves do not intersect at any of those points, I can not get the point of intersection.
I'm attaching a figure for more clarity.

I believe I will have a set of points here instead a single point.
How do I get those set of points from the scatter plot data or the data points I have now?
Thanks..
2 commentaires
Tony
le 21 Juin 2024
The pair of points on the two curves with the smallest Euclidean distance between them will be the intersection point. If you are looking for multiple, then you can put a threshold; e.g. find the pairs of points whose distance is less than 1e-6
Prasanna Routray
le 21 Juin 2024
Réponse acceptée
Plus de réponses (1)
Bruno Luong
le 5 Oct 2024
Modifié(e) : Bruno Luong
le 5 Oct 2024
Use this file exchange https://www.mathworks.com/matlabcentral/fileexchange/22441-curve-intersections
This code is robust, it doesn't break for repeating x or y coordinates.
The curves are assumed to me line segments connectings data points. Intersection coordinates of two line segments that meet are returned, and all of them.
x1 = -100:1:100;
y1 = 5*ones(size(x1));
y2 = -100:1:100;
x2 = 5*ones(size(y2));
X = InterX([x1; y1],[x2; y2]);
plot(x1,y1,'-',x2,y2,'-.',X(1,:),X(2,:),'or')

1 commentaire
Prasanna Routray
le 5 Oct 2024
Catégories
En savoir plus sur Spline Postprocessing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


