How to find value of Y if i know X value from grap
393 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
navi g
am 9 Jan. 2017
Kommentiert: Walter Roberson
am 29 Apr. 2020
i search on matlab searching question but not found it. I have a graph with a curve. I want to know the Y value from my graph example X = 10 to 11, till 10 to 11 in y axis i have to mark. how to find Y?
i also seen some example like this, i can find for one x value one y value, but continues x data how to mark in cureve
%example having only one x data X = 1:0.1:20;
Y = sin(X);
index = find(X==10);
Y_point = Y(index)
% See graphically
plot(X,Y,X(index),Y_point,'o')
my question is now how to mark for x value 10 to 11
0 Kommentare
Akzeptierte Antwort
KSSV
am 9 Jan. 2017
Bearbeitet: KSSV
am 9 Jan. 2017
clc; clear all ;
X = 1:0.1:20;
Y = sin(X);
index = find(X==10);
Y_point = Y(index)
% See graphically
plot(X,Y,X(index),Y_point,'o')
hold on
% plot X in the range 10 to 11
Xi = X(X>=10 & X<=11) ;
Yi = Y(X>=10 & X<=11) ;
plot(Xi,Yi,'*k')
3 Kommentare
afiq hassan
am 25 Apr. 2020
But what if I want to find value from x axis and I already know the y axis?
Walter Roberson
am 29 Apr. 2020
[~, idx] = min( abs(Y_values - target_y_value) );
closest_x = X_values(idx);
closed_y = Y_values(idx);
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!