http://www.mathworks.com/matlabcentral/newsreader/view_thread/288691
MATLAB Central Newsreader  plot circular data (e.g. vehicle trajectories of a ringroad)
Feed for thread: plot circular data (e.g. vehicle trajectories of a ringroad)
enus
©19942014 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
http://www.mathworks.com/images/membrane_icon.gif

Fri, 06 Aug 2010 13:07:05 +0000
plot circular data (e.g. vehicle trajectories of a ringroad)
http://www.mathworks.com/matlabcentral/newsreader/view_thread/288691#769135
Thomas Schreiter
Hi,<br>
<br>
I have a 2D data set of vehicle trajectories, containing the position of every vehicle at every time step. This position refers to a location of a ringroad. A ringroad of 1000m length has a jump in its location numbering: After meter 999 you reach "the beginning" of the ringroad at meter 0 again, much like in a car race at the startfinish line.)<br>
<br>
Plotting these trajectories with the plot command leads to an ugly plot:<br>
(1.) The plot show large jumps near the startfinish line, caused by the linear interpolation of the plot function. Instead, I'd like to interpolate in a _circular_ manner. <br>
(2.) It is not possible to pan the plot in the spatial dimension near the startfinish line.<br>
<br>
Is there an easy solution to this problem?

Fri, 06 Aug 2010 13:44:04 +0000
Re: plot circular data (e.g. vehicle trajectories of a ringroad)
http://www.mathworks.com/matlabcentral/newsreader/view_thread/288691#769157
Joseph
I'm not sure I totally get this question but why not just wrap the data? In other words, add 1000m to your value ever time you get to the 999 > 0 jump.<br>
<br>
<br>
<br>
"Thomas Schreiter" <t.schreiter@tudelft.nl> wrote in message <i3h1dp$s9o$1@fred.mathworks.com>...<br>
> Hi,<br>
> <br>
> I have a 2D data set of vehicle trajectories, containing the position of every vehicle at every time step. This position refers to a location of a ringroad. A ringroad of 1000m length has a jump in its location numbering: After meter 999 you reach "the beginning" of the ringroad at meter 0 again, much like in a car race at the startfinish line.)<br>
> <br>
> Plotting these trajectories with the plot command leads to an ugly plot:<br>
> (1.) The plot show large jumps near the startfinish line, caused by the linear interpolation of the plot function. Instead, I'd like to interpolate in a _circular_ manner. <br>
> (2.) It is not possible to pan the plot in the spatial dimension near the startfinish line.<br>
> <br>
> Is there an easy solution to this problem?

Fri, 06 Aug 2010 14:04:06 +0000
Re: plot circular data (e.g. vehicle trajectories of a ringroad)
http://www.mathworks.com/matlabcentral/newsreader/view_thread/288691#769168
Thomas Schreiter
Hi, Joseph.<br>
<br>
The data are well formatted. The problem is the visualization. For example, let X denote the position of one vehicle over time traveling with constant speed, say X = [ 100 300 500 700 900 100 300 500 ]. Plot(X) connects the points (5,900) and (6,100). But this line does not reflect the trajectory of the vehicle!

Fri, 06 Aug 2010 14:43:06 +0000
Re: plot circular data (e.g. vehicle trajectories of a ringroad)
http://www.mathworks.com/matlabcentral/newsreader/view_thread/288691#769178
Sean
"Thomas Schreiter" <t.schreiter@tudelft.nl> wrote in message <i3h4om$5td$1@fred.mathworks.com>...<br>
> Hi, Joseph.<br>
> <br>
> The data are well formatted. The problem is the visualization. For example, let X denote the position of one vehicle over time traveling with constant speed, say X = [ 100 300 500 700 900 100 300 500 ]. Plot(X) connects the points (5,900) and (6,100). But this line does not reflect the trajectory of the vehicle!<br>
<br>
This may (or may just as easily not) be what you're looking for:<br>
doc feather

Fri, 06 Aug 2010 20:00:36 +0000
Re: plot circular data (e.g. vehicle trajectories of a ringroad)
http://www.mathworks.com/matlabcentral/newsreader/view_thread/288691#769310
Roger Stafford
> "Thomas Schreiter" <t.schreiter@tudelft.nl> wrote in message <i3h1dp$s9o$1@fred.mathworks.com>...<br>
> > Hi,<br>
> > <br>
> > I have a 2D data set of vehicle trajectories, containing the position of every vehicle at every time step. This position refers to a location of a ringroad. A ringroad of 1000m length has a jump in its location numbering: After meter 999 you reach "the beginning" of the ringroad at meter 0 again, much like in a car race at the startfinish line.)<br>
> > <br>
> > Plotting these trajectories with the plot command leads to an ugly plot:<br>
> > (1.) The plot show large jumps near the startfinish line, caused by the linear interpolation of the plot function. Instead, I'd like to interpolate in a _circular_ manner. <br>
> > (2.) It is not possible to pan the plot in the spatial dimension near the startfinish line.<br>
> > <br>
> > Is there an easy solution to this problem?<br>
<br>
"Joseph " <don'twannapostit@nopers.com> wrote in message <i3h3j4$jah$1@fred.mathworks.com>...<br>
> I'm not sure I totally get this question but why not just wrap the data? In other words, add 1000m to your value ever time you get to the 999 > 0 jump.<br>
        <br>
You can use matlab's 'unwrap' function to carry out Joseph's idea if you rescale your 1000 meter values to 2*pi. Let P be an array in which each column gives the successive positions of a corresponding vehicle.<br>
<br>
Q = 1000/(2*pi)*unwrap((2*pi/1000)*P);<br>
<br>
Then use Q for your plotting.<br>
<br>
This works provided no vehicle travels more than 500 meters between subsequent time points. Otherwise you would need something a little more sophisticated than 'unwrap' involving probable velocities and accelerations.<br>
<br>
It is assumed here that the vehicles are recorded at the same number of points. If the numbers of points are different you would have to do an 'unwrap' for each vehicle separately.<br>
<br>
Roger Stafford