Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Cross posted from stackoverflow at the suggestion of a commenter.

I have a series of CSV files of timestamped coordinates (X, Y, and Z in mm). What would be the simplest way to extract motion data from them?


The information I'd like to extract includes the following:

  • Number of direction changes
  • Initial acceleration of the first and last movements
  • Bearing (angle) of these movements
  • Average speed whilst non-stationary

Ideally, I'd eventually like to be able to categorise patterns of motion, so bonus points for anyone who can suggest a way of doing this. It strikes me that one way I could do this would be to generate pictures/videos of the motion from the coordinates and ask humans to categorise them - suggestions as to how I'd do this are very welcome.


A complication is the fact that the readings are polluted with noise. In order to overcome this, each recording is prefaced with at least 20 seconds of stillness which can serve as a sort of "noise profile". I'm not sure how to implement this though.


If it helps, the motion being recorded is that of a persons hand during a simple grabbing task. The data is generated using a magnetic motion tracker attached to the wrist. Also, I'm using C#, but I guess the maths is language agnostic.


There is a bounty open on the original question, so feel free to post your answers there as well as here.

share|cite|improve this question
You want to do what 3Sphere suggests in the answer below, and then filter it using a Kalman Filter. Let me know if you're still interested in this problem and I can explain more. – Chris Taylor Jun 9 '11 at 20:03
up vote 0 down vote accepted

If I were modeling this, I would treat the initial point in the file as the displacement relative to the some fixed point and each subsequent point as a displacement from the previous point. In this way, you effectively end up with a sequence of vectors that can be reasoned over using standard methods from vector analysis. That is, the points in the file $\{p_0, p_1, \dots p_n\}$ yield the sequence of vectors $\{v_0 = p_1, v_1 = p_1 - p_0, \dots v_n = p_n - p_{n-1} \}$. Using these vectors you can then find the angle between them, determine the average speed, etc, according to elementary formula. As for dealing with noise in your data, I can't comment much on that other than to note that it might be helpful to introduce a notion of tolerance similar to that which is introduced to determine whether two floating point numbers are "equal". If the magntitude of displacement between point $p_i$ and $p_j$ is less than some tolerance value $\epsilon$ and/or change in direction also falls within a certain level of tolerance then perhaps it can be ignored. There are of course much more sophisticated statistical techniques that can be employed that I'm not really qualified to explain.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.