How can i plot the data for specific time intervals?
조회 수: 44 (최근 30일)
이전 댓글 표시
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...
댓글 수: 0
채택된 답변
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
Habtamu asres
2022년 12월 5일
Please help me How to store this limited time interval values on workspace
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!