how to find intersection point between two paired matriices

조회 수: 1 (최근 30일)
CHRISTOPHER S
CHRISTOPHER S 2020년 11월 24일
답변: Sameer 2025년 6월 5일
A=100*100
B =100*100
C=1*100
D=1*100
how to find intercept of [A B] on [C D]

답변 (1개)

Sameer
Sameer 2025년 6월 5일
To find the intersection points between two paired matrices, where each row in [A B] and [C D] represents coordinates (like x and y), you can treat them as sets of 2D points and look for common rows.
Assuming A, B, C, and D are 1×100 vectors, you can do the following:
AB = [A(:), B(:)];
CD = [C(:), D(:)];
[commonPoints, ia, ib] = intersect(AB, CD, 'rows');
This will return the intersection points in "commonPoints", along with their indices in "AB" and "CD".
Note: This method works well if values match exactly. If you're dealing with floating-point data and want to allow a small tolerance, consider using rounding or a custom distance check instead.
For more details please refer to the following documentation:
Hope this helps!

카테고리

Help CenterFile Exchange에서 NaNs에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by