MATLAB: Coordonates of X knowing Y.

axiscoordinatesgraphicMATLABxy

I have values for X and Y. For example: X=[1 2 3 4] and Y=[6 7 8 9] and I make a graphic using plot. But I want to find the X coordonate of Y= 8.5, so for a point between 2 of my Y values. How do I do this? Thanks!

Best Answer

x=[1 6 8 9]
y=[3 6 9 14]
plot(x,y)
y0=8.5
x0=interp1(y,x,y0)