intersect() returns unplausible values
Mostrar comentarios más antiguos
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!

Respuesta aceptada
Más respuestas (1)
Image Analyst
el 23 de Nov. de 2021
0 votos
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)
Categorías
Más información sobre MATLAB Support Package for IP Cameras en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!