How to located a point on top, in between and below two curves.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Paul Kpantey
el 2 de Abr. de 2020
Comentada: Paul Kpantey
el 4 de Abr. de 2020
I need help I have two curves ploted which meets at both ends. I want , when a user enters a point, it should tell the user whether the point entered is above the upper curve or on the upper curve or in between the curves or on the lower curve or below the lower curve. Below is my code;
if true
X = 0 : 20 : 100;
y1 = [ 1085 1160 1230 1310 1380 1453 ];
y2 = [ 1085 1198 1280 1350 1405 1453 ];
plot(x, y1,'r'); % plot lower curve
Hold on;
plot(x, y2, 'b'); %plot upper curve
X = input('enter the value of x: ');
Y = input('enter the value of y: ');
plot (X , Y ,'g'); % user ploted points
end
So all i am saying is that; After the user has entered the X and the Y values and it is ploted , there should be some codes to determine whether the point ploted or entered is above the upper curve or on the upper curve or in between the curves or on the lower curve or below the lower curve . I hope am making sense since am not quite matlab friendly. Please help.
2 comentarios
John D'Errico
el 3 de Abr. de 2020
Do you kow how to use interpolation, for example, interp1? If not, then it is time to learn.
Can you interpolate each curve, at the given x value? How would that tell you if the point is above or below each curve? How will that allow you to answer your question?
Respuesta aceptada
the cyclist
el 3 de Abr. de 2020
Editada: the cyclist
el 3 de Abr. de 2020
10 comentarios
Image Analyst
el 3 de Abr. de 2020
You were going to look into interp1(), remember? So just reverse y and x and use it. Something like (untested)
x1 = interp1(yBlue, xBlue, yGreen);
x2 = interp1(yRed, xRed, yGreen);
Más respuestas (0)
Ver también
Categorías
Más información sobre Surface and Mesh Plots 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!