Effacer les filtres
Effacer les filtres

How to find the zero vaue of a plot?

1 vue (au cours des 30 derniers jours)
Pietro Fiondella
Pietro Fiondella le 28 Juin 2022
Modifié(e) : Les Beckham le 28 Juin 2022
I have 2 vetors X ,Y plotted Y vs X.
The plot it's made by 2 differrent straight line.
I would like to find the "zero- value"
X=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20];
Y=[-0.88 -0.7489 -0.6178 -0.4867 -0.3556 -0.2245 -0.0934 0.0378 0.1689 0.3 0.4311 0.5182 0.6053 0.6924 0.7795 0.8666 0.9537 1.0408 1.1279 1.2150 1.3022];
plot(A,B
Aussuming that Y=f(X) i would like to find Xo for having Y(Xo)=0
I have not the function equation, and i know it would be easy to directly find it in this case, but i am looking for a way to find the 'zero' value of the x-axis for any 2 set of numbers X, Y

Réponse acceptée

Les Beckham
Les Beckham le 28 Juin 2022
Modifié(e) : Les Beckham le 28 Juin 2022
X=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20];
Y=[-0.88 -0.7489 -0.6178 -0.4867 -0.3556 -0.2245 -0.0934 0.0378 0.1689 0.3 0.4311 0.5182 0.6053 0.6924 0.7795 0.8666 0.9537 1.0408 1.1279 1.2150 1.3022];
plot(X, Y)
% Find the value of x corresponding to Y = 0
x0 = interp1(Y, X, 0)
x0 = 6.7119
hold on
plot(x0, 0, 'r*')
grid on

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Tags

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by