Filter löschen
Filter löschen

How to find the zero vaue of a plot?

1 Ansicht (letzte 30 Tage)
Pietro Fiondella
Pietro Fiondella am 28 Jun. 2022
Bearbeitet: Les Beckham am 28 Jun. 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

Akzeptierte Antwort

Les Beckham
Les Beckham am 28 Jun. 2022
Bearbeitet: Les Beckham am 28 Jun. 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

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by