Find out the intersection of two curves despite NaN-Values
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Benedikt Friedrich Nowak
el 8 de Nov. de 2022
Comentada: Benedikt Friedrich Nowak
el 9 de Nov. de 2022
Hello there,
im struggeling with a the intersection of two curves. One curve is defined as a function :
x= (0 : 50)
y=(m*x)+yaxis (m and yaxis are constants).
The other curves is defined as a dataset of two vectors. Lets say:
V1=[1 2 3 4 5] and V2=[50 80 NaN 90 100].
Right now im using polyxpoly, but it struggels with the NaN-Value:
[xi,yi] = polyxpoly(V1,V2,x,y)
xi and yi would be the intersection.
Does anyone have a better alternative ?
Thank you for your help, Ben !
0 comentarios
Respuesta aceptada
Jan
el 8 de Nov. de 2022
Editada: Jan
el 8 de Nov. de 2022
x = 0:50;
m = 0.234;
yaxis = 60;
y = (m*x)+yaxis;
V1 = [1 2 3 4 5];
V2 = [50 80 NaN 90 100];
V1(isnan(V2)) = nan; % Avoid error message from polyxpoly
[xi,yi] = polyxpoly(V1,V2,x,y)
plot(x, y);
hold('on');
plot(V1, V2);
plot(xi, yi, 'ok')
I'm not sure what "it struggels with the NaN-Value" means. Without setting the x-value to NaN at locations, where the y-value is NaN, polyxpoly throghs an error. But with a cleaning the code runs fine. So what exactly is the problem?
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Exploration en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!