# How to find value of Y if i know X value from graph

Asked by uncung fgv on 14 Aug 2012
Latest activity Commented on by Image Analyst on 14 Aug 2012

I have a graph with a curve. I want to know the Y value from my graph

example X = 10

how to find Y?

thx.

MRR on 14 Aug 2012
```%example
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');
```
uncung fgv on 14 Aug 2012

not this what i man, i have no X, Y data. I only have hiperbolic curve in matlab graph/file.

## Products

No products are associated with this question.

Answer by Julian Laackmann on 14 Aug 2012

Since your question is not really clear there are a few possibilities of how to get the value. Two methods are displayed beneath assuming that the graph is plotted in Matlab.

1. If there is a data point at x = 10 you can use the 'Data Cursor' tool found at the top of the graph. Just mark the point and the tool tip will show you the value.
2. If there is no data point at x = 10 but you have plotted the graph or have got the table with values you can use the interpolation functions, e.g. 'interp1', to get the value in between two data points. Depending on the form of your data you have to choose the interpolation method. Take a look here, try different methods ('spline' works often) and plot the results of the different methods over your data to see if they fit.

If the graph is an image, e.g. a 'jpg' or 'tiff', you have to resort to other methods to directly read the information from the image.

uncung fgv on 14 Aug 2012

my plot in matlab file. actually the curve is hyperbolic. X data is heigh

Y is velocity

so I want to find E=1/2 mv^2.

I have m data it is ok to find one by one Y data. by using Data Cursor. I want find many Y data from this plot.

uncung fgv on 14 Aug 2012

i mean how to get data from figure file.

Image Analyst on 14 Aug 2012

So all you have is a .fig file with the saved figure? You have absolutely no way to get the original data that was plotted to make the figure? There are submissions in the File Exchange to help you digitize values off a picture, such as http://www.mathworks.com/matlabcentral/fileexchange/36904-matlab-script-for-digitizing-a-published-graph