Intersection of Discretized Curves
古いコメントを表示
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 件のコメント
Tony
2024 年 6 月 21 日
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
2024 年 6 月 21 日
採用された回答
その他の回答 (1 件)
Bruno Luong
2024 年 10 月 5 日
編集済み: Bruno Luong
2024 年 10 月 5 日
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')

カテゴリ
ヘルプ センター および File Exchange で Spline Postprocessing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


