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!