Borrar filtros
Borrar filtros

Detecting path/trajectory turns in tracking data

10 visualizaciones (últimos 30 días)
Right Grievous
Right Grievous el 11 de Feb. de 2015
Respondida: Star Strider el 12 de Feb. de 2015
Hi all,
I have some 2D cartesian position data (x,y,time) for a moving object, I would love the extract all of the points where the path/trajectory of this object changed in a particular way. For instance, I would like to know everywhere the object made a turn greater than 90 degrees in less than 2 seconds.
I tried extracting the object's instantaneous heading and then looking for places where this heading changes by an angle greater than a certain cutoff, however, this seems to be missing a lot of turns. I was wondering if there was some clever Matlab way to do what I want?
EDIT: I have attached some sample data, this is one file of many which I have to process. The data are arranged X,Y and time. The data are sampled at 10Hz I believe.
  2 comentarios
Star Strider
Star Strider el 12 de Feb. de 2015
Attaching all of it, or if it is a large data set, a representative sample of it (preferably as a .mat file) and especially including a part where it is difficult to find the heading change with your present code, would help. Include relevant details as sampling intervals or times, and other such information.
Right Grievous
Right Grievous el 12 de Feb. de 2015
I have attached some sample data... there isn't much to it I'm afraid, just x, y and time.

Iniciar sesión para comentar.

Respuestas (2)

Star Strider
Star Strider el 12 de Feb. de 2015
Here is one possibility, using filter:
d = load('Right Grievous SampleData.mat');
x = d.x(:,1);
y = d.x(:,2);
t = d.x(:,3);
dx = gradient(x, 0.1);
dy = gradient(y, 0.1);
dt = gradient(t);
hdc = pi/2; % Critical Heading Change
hdg = atan2(dy,dx); % Heading
sec = 2; % ‘Look Ahead’ Time (sec)
dhdg = filter([1 zeros(1,sec*10-2) 1], 2, hdg);
hdgidx = find(abs(dhdg) >= hdc); % Find ‘dhdg’ >= pi/2
plot3(x, y, t)
hold on
plot3(x(hdgidx), y(hdgidx), t(hdgidx), '.r')
hold off
grid on
It uses filter to look at two headings separated by the requisite number of seconds, calculates the differences, and plots them as red dots on the trajectory. I’m not sure what you want, so I encourage you to experiment with it until you get the result you want. You might also consider subtracting a constant from ‘hdgidx’ to change the red dot position from the 20th position to another. For instance, to put a dot at the midpoint instead of the end of the look-forward time, consider subtracting 10, or fix(10*sec/2).

daniel el 12 de Feb. de 2015
What navigational data do you have in your data set? Is your data in semi-circles or degrees?
  1 comentario
Right Grievous
Right Grievous el 12 de Feb. de 2015
I don't understand, I have Cartesian (X,Y) coordinates and time (s). I calculated heading direction at each point and then smoothed this over a 2.5s window. So the heading info wasn't there to begin with.

Iniciar sesión para comentar.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by