필터 지우기
필터 지우기

How can i plot the data for specific time intervals?

조회 수: 32 (최근 30일)
Madhuri
Madhuri 2017년 6월 16일
댓글: Habtamu asres 2022년 12월 5일
Am trying to plot vehicle trajectories(time-space plots) using following data. I have plotted all the vehicles for whole time duration of 15 minutes.Now I need to Plot it for particular time periods( for e.g.,between 100 sec and 400 sec) for all vehicle numbers in that time interval.How can i select the data only for a particular time interval and plot for all vehicles in a single figure?
Data format: Veh_no 2 2 2 2 2 2 ..3 3 3 3 3 3... 4 4 4 4... time(sec) 0 0.1 0.2 0.3 0.4 0.5 ..0.2 0.3 0.4 0.5 0.6 0.7...0.1 0.2 0.3 0.4 distance(m) 0 0.2 0.5 0.8 0.9...0.3 0.4 0.7 0.9 1.3 1.5...0.2 0.4 0.8 1.1...

채택된 답변

KSSV
KSSV 2017년 6월 16일
Check the below code:
t =0:0.01:2*pi ;
x = sin(t) ;
plot(t,x)
%%draw data only between 2 and 4
idx = (t>2 & t <=4) ;
hold on
plot(t(idx),x(idx),'.r')
You can get logicals of the indices which you want to plot, and use these logical indices for plotting.
  댓글 수: 2
Madhuri
Madhuri 2017년 9월 17일
Thank you.
Habtamu asres
Habtamu asres 2022년 12월 5일
Please help me How to store this limited time interval values on workspace

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by