Question about finding y value for certain x value of a plot

747 views (last 30 days)
yc j
yc j on 25 Jan 2016
Commented: Feroz Mulani on 10 Mar 2021
Hello, I have a question about data cursor. My data plot gives me a data cursor which goes by 0.5 for the x-axis values.
For example, when i move the curse right side, it goes like 0.5, 1.0, 1.5, 2.0...
Say I want to know the y-value at the x-value of 5.1
I guess the most simple way is to zoom in and see the value, but there are about 1 thousand data to work with.
Therefore, I want to give a commend that orders to give the y-value at certain x-value. If there isn't a data set, it would be nice to get the value of how the plot line is drawn for the points...(interpolation etc..)
How can I do that?

Accepted Answer

Ilham Hardy
Ilham Hardy on 25 Jan 2016
If you have your plot data,
desiredY = interp1(yourXaxisdata,yourYaxisdata,certainX);
  6 Comments
Feroz Mulani
Feroz Mulani on 10 Mar 2021
If i want to find a value say e.g value of x at function y = 1, then how should i write.

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!

Translated by