Difficult to phrase question about plotting trajectories from a fixed array

3 visualizzazioni (ultimi 30 giorni)
Hi guys,
This is something that's been bugging me for hours now.
I have a system of vehicles travelling along a road with periodic boundary conditions (vehicles reach road end and loop back to start). I have defined the vehicle closest to the start of the road (x=0) as always vehicle 1, then vehicle 2, etc. This means that when a vehicle reaches the end and loops back to the start, this vehicle now becomes vehicle 1.
Recording the X positions every second, for a 30m road with 10 vehicles all moving at 1m/s gives an array like this:
v1 v2 v3 ... v10
t1 1 4 7 28
t2 2 5 8 29
t3 3 6 9 30
t4 1 4 7 28
t5 2 5 8 29
t6 3 6 9 30
t7 1 4 7 28
Plotting this gives:
Whereas I'd like to see:
But I can't think of a way to do this :( I'm sorry if this question is not very clear, but as I say I'm pretty stuck. Any help would be greatly appreciated.
Cheers

Risposte (0)

Categorie

Scopri di più su MATLAB 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!

Translated by