intersect() returns unplausible values
Ältere Kommentare anzeigen
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!

Akzeptierte Antwort
Weitere Antworten (1)
Image Analyst
am 23 Nov. 2021
0 Stimmen
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)
Kategorien
Mehr zu MATLAB Support Package for IP Cameras 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!