How can i plot the data for specific time intervals?
45 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
KSSV
il 16 Giu 2017
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 Commenti
Habtamu asres
il 5 Dic 2022
Please help me How to store this limited time interval values on workspace
Più risposte (0)
Vedere anche
Categorie
Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!