How to mark a specific point in matlab plot?

11 visualizaciones (últimos 30 días)
LIM MING HUI
LIM MING HUI el 10 de Abr. de 2022
Comentada: Voss el 12 de Abr. de 2022
Hello,
I'm trying to mark a specific point on the curves when y = 0. Because I want to know the value of x when y = 0.
but I didn't succeed....
x = 0:0.01:66.03;
y=(3.7*(10*(x/66.03).^3-15*(x/66.03).^4+6*(x/66.03).^5)-1.86);
plot(x,y,'c-','LineWidth',3);
y1=0;
x1=interp1(x,y,y);
hold on;
semilogy(x1,y1,'*r')
Any idea on how to fix the problem?
Thank you in advance for your help!

Respuesta aceptada

Voss
Voss el 10 de Abr. de 2022
To interpolate to find a value of x for a given value of y, treat y as the independent variable and x as dependent on y.
x = 0:0.01:66.03;
y=(3.7*(10*(x/66.03).^3-15*(x/66.03).^4+6*(x/66.03).^5)-1.86);
plot(x,y,'c-','LineWidth',3);
y1=0;
% x1=interp1(x,y,y);
x1=interp1(y,x,y1); % given x(y), find x(y1)
hold on;
semilogy(x1,y1,'*r')
  2 comentarios
LIM MING HUI
LIM MING HUI el 12 de Abr. de 2022
Thank you! It is works!
Voss
Voss el 12 de Abr. de 2022
You're welcome!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Interpolation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by