MATLAB: How to extract a certain datapoint from a curve

curvedata pointMATLAB

I would like to extract a specific data point from curves. Attached an example curve. Need to find, when x=14.3, what's the value of y?
Need help to achieve this. Many thanks.

Best Answer

Try this:
x = linspace(0, 100); % Create Vector

y = 25 - 10*sin(2*pi*x/100); % Create Vector
xq = 14.3;
yq = interp1(x, y, xq); % Interpolate To Determine Value
figure
plot(x, y)
hold on
plot(xq, yq, '+r')
hold off
ylim([0 40])
text(xq, yq, sprintf('\\leftarrow y(%.1f) = %.1f', xq, yq), 'HorizontalAlignment','left','VerticalAlignment','middle')
.