Intersection of Discretized Curves
Ältere Kommentare anzeigen
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 Kommentare
Tony
am 21 Jun. 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
am 21 Jun. 2024
Akzeptierte Antwort
Weitere Antworten (1)
Bruno Luong
am 5 Okt. 2024
Bearbeitet: Bruno Luong
am 5 Okt. 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 Kommentar
Prasanna Routray
am 5 Okt. 2024
Kategorien
Mehr zu Spline Postprocessing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


