How to mark a specific point in matlab plot?

6 vues (au cours des 30 derniers jours)
LIM MING HUI
LIM MING HUI le 10 Avr 2022
Commenté : Voss le 12 Avr 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!

Réponse acceptée

Voss
Voss le 10 Avr 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 commentaires
LIM MING HUI
LIM MING HUI le 12 Avr 2022
Thank you! It is works!
Voss
Voss le 12 Avr 2022
You're welcome!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Interpolation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by