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

I'm working on a mobile phone app idea the moment.

This app is currently being prototype on a Windows Phone 7 device.

The Motion API on that device gives me frequent updates on :

  • the current 3 dimensional acceleration vector (with gravity removed) of the phone (with axes fixed as the axes of the phone)
  • the current direction that gravity is (using those same phone axes)

I'm thinking about how to estimate the actual velocity and position of the phone, assuming that the phone started from a "stationary" position.

I'm currently trying to do this by rotatomg the acceleration vector (using the gravity vector somehow) so that it's in real world coordinates, and then I'm thinking of using simple integration over time in order to estimate current 3D velocity, and then another integration to get to current 3D position.

Should this approach work? Does anyone have any suggestions about where I should look for primers on the vector/matrix maths required?



share|cite|improve this question

The approach should work, but the challenge is drift due to errors. If the acceleration is off by a small constant amount, the error in position will grow quadratically with time. Also how the the phone know which direction is vertical so it can subtract gravity? Say you have $0.1 g$ acceleration in the $x$ direction. The sensor will see about $1.005 g$ in the $xz$ plane, but there are other directions for $x, z$ that produce the same reading. Presumably it is from angular accelerometers in the phone, which will also have drift. The usual approach is to have actual measurements of position and angle periodically to update and get rid of the drift terms. Do you have position available as well? You can make some improvement by measuring the output when the device is motionless (sitting on a table) and subtracting the drift, but maybe it does that already for you.

As to the rotation matrices, Wikipedia probably has more than you need. Any classical mechanics text will have a discussion as well.

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.