How to extract data from a plot for various values of X and Y axis?

조회 수: 4 (최근 30일)
Praveen Kumar
Praveen Kumar 2017년 9월 7일
댓글: Praveen Kumar 2017년 9월 7일
I have a speed vs time plot. Now I have to extract the speed data for a particular time which is used in a 'for loop'.
For example: for t=0:1:10
First iteration, I have to get the speed data for t=0;
Second iteration obtain the value of speed @ t= 1 sec ...... and so on...
  댓글 수: 2
KSSV
KSSV 2017년 9월 7일
YOu have data already in hand? What plot's you have in hand?
Praveen Kumar
Praveen Kumar 2017년 9월 7일
I have a speed vs time plot.

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

답변 (1개)

Sathyanarayan Rao
Sathyanarayan Rao 2017년 9월 7일
speed = [1 2 3 4 5]
time = [0.03 0.05 0.07 0.09 0.1]
h = plot(time,speed);
xdata = (get(h, 'XData'))
ydata = (get(h, 'YData'))
  댓글 수: 1
Praveen Kumar
Praveen Kumar 2017년 9월 7일
In this case, xdata will be
xdata =
0.0300 0.0500 0.0700 0.0900 0.1000
ydata =
1 2 3 4 5
But i want values of xdata for any values between 0 and 0.1.
For example: xdata= [0.01 0.02 0.03 ..... 0.1], 10 data points.
Need not be same as the number of input data in time(5 discrete points in your case)

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

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by