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

조회 수: 111 (최근 30일)
yc j
yc j 2016년 1월 25일
댓글: Ganesh P. Prajapat 2023년 1월 21일
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?

채택된 답변

Ilham Hardy
Ilham Hardy 2016년 1월 25일
If you have your plot data,
desiredY = interp1(yourXaxisdata,yourYaxisdata,certainX);
  댓글 수: 10
Torsten
Torsten 2022년 3월 10일
If X and Y are your data arrays and Xq are your query points, use
Yq = interp1(X,Y,Xq);
Ganesh P. Prajapat
Ganesh P. Prajapat 2023년 1월 21일
Yas, it works perfectly. Thnak you

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by