intersect() returns unplausible values
이전 댓글 표시
I am trying to return the coordinates of the intersection of two lines (please see below plot). I need the x- and y-values of the point of intersection. Code looks like this:
%Arbeitspunkt Daten
%Mm = blue line
%Mld = red dashed line
if Mld > 0
[M_ap, s_ap] = intersect(Mm, Mld);
app.LabelM_ap.Visible = 'on';
app.LabelM_ap.Text = sprintf('%.1f', M_ap);
else
app.LabelM_ap.Visible = 'off';
end
However, I set a breakpoint at the last "end" and reviewed the workspace variables M_ap and s_ap. For those two variables I do not get any values written back from intersect() function, even tho there is a intersection between these two lines at roughly ~95%
Mm and Mld are both 1x100000 double.
Does intersect()-function have trouble processing double format? Is there a way to integrate this differently?
Thanks in advance!

채택된 답변
추가 답변 (1개)
Image Analyst
2021년 11월 23일
0 개 추천
That's not what intersect does.
C = intersect(A,B) returns the data common to both A and B, with no repetitions. C is in sorted order.
If you want to find where two curves cross you'll have to use a different method. And it depends if you want to do it numerically (nearest actual index) or analytically (exact, but interpolated, index location)
카테고리
도움말 센터 및 File Exchange에서 MATLAB Support Package for IP Cameras에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!