Extract data from plot

2 views (last 30 days)
Hello all I have a plotted a graph with x=1 2 3 4 5 and y = 2 4 6 8 10. Now I want to mark y= 6.5 on the plot. How to do it. I have asked this question in a simple way but the actual data I have is so big. Hoping for suggestions Thanking you

Accepted Answer

esat gulhan
esat gulhan on 18 Sep 2020
Maybe like this
x=[1 2 3 4 5]; %x data
y =[2 4 6 8 10];%y data
yy=6.5 % y value you intend to reach
xx = interp1(y,x,yy,'spline') %interpolation type, i choose spline, but you can choose pchip,lineer etc...
plot(xx,yy,'o'); %plot value
hold on
plot(x,y,'r'); grid on; %plot x y datas
Vinay Srinivasan
Vinay Srinivasan on 18 Sep 2020
Ok thank you so much, it worked

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!