Path: news.mathworks.com!not-for-mail From: <HIDDEN> Newsgroups: comp.soft-sys.matlab Subject: Re: plot circular data (e.g. vehicle trajectories of a ringroad) Date: Fri, 6 Aug 2010 20:00:36 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 25 Message-ID: <i3hpl4$oah$1@fred.mathworks.com> References: <i3h1dp$s9o$1@fred.mathworks.com> <i3h3j4$jah$1@fred.mathworks.com> Reply-To: <HIDDEN> NNTP-Posting-Host: webapp-03-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: fred.mathworks.com 1281124836 24913 172.30.248.38 (6 Aug 2010 20:00:36 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Fri, 6 Aug 2010 20:00:36 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1187260 Xref: news.mathworks.com comp.soft-sys.matlab:659880 > "Thomas Schreiter" <t.schreiter@tudelft.nl> wrote in message <i3h1dp$s9o$1@fred.mathworks.com>... > > Hi, > > > > 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 start-finish line.) > > > > Plotting these trajectories with the plot command leads to an ugly plot: > > (1.) The plot show large jumps near the start-finish line, caused by the linear interpolation of the plot function. Instead, I'd like to interpolate in a _circular_ manner. > > (2.) It is not possible to pan the plot in the spatial dimension near the start-finish line. > > > > Is there an easy solution to this problem? "Joseph " <don'twannapostit@nopers.com> wrote in message <i3h3j4$jah$1@fred.mathworks.com>... > 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. - - - - - - - - - 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. Q = 1000/(2*pi)*unwrap((2*pi/1000)*P); Then use Q for your plotting. 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. 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. Roger Stafford