Using TYPE_LINEAR_ACCELERATION suppose I found out that the device is moving at 4 m/s².


How much accurate it would be?

closed as unclear what you're asking by user40980, gnat, GlenH7, Kilian Foth, Bart van Ingen Schenau Nov 5 '13 at 10:50

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    Are you asking the for the math to identify the error on a given value? or are you looking for a way identify how to improve the value? Are you taking multiple values? Consider that with Android, it is quite possible for different devices to have different error values from their accelerometer. Unless calibrated somehow (drop it into a foam padding from a height of 2 meters?), it may be impossible to tell. – user40980 Nov 4 '13 at 16:02

There are two sources of errors here: (a) numerical inaccuracies stemming from floating-point representations, and (b) general measurement errors, which in turn are either (b.1) calibration errors (your accelerometer has a skewed or drifting scale) or (b.2) statistical uncertainty.

Errors from (a) are difficult, but possible to quantify exactly. However, they are likely small when compared with (b).

Errors from (b.1) can be compensated by calibrating the accelerometer with other devices. In the general case, this involves transforming the data along a calibration curve. Note that this can amplify errors from (b.2).

Errors from (b.2) cannot be corrected, but we can use them to say how exact our end result is. First, the uncertainty has to be quantified by measuring the acceleration in an experiment (e.g. dropping the device, and wirelessly collecting acceleration data) which is repeated as often as possible. From the data set, we can calculate the mean μa, and the standard deviation σa for the acceleration. Because your average Android device has varying air resistance depending on the orientation, the measurements will be probably spread over a large interval.

We now wish to estimate the standard deviation of the displacement s in dependency of the acceleration a. First, they are related via:

s(t) = ½ a · t²

because a = d²/dt² s ⇔ s = ∫∫ a dt² ⇔ ∫ a·t dt.

Now, σs can be calculated as:

σs = ( ∂/∂a s(t) )² · σa²

which is terribly convenient, because then

σs = (½ · t²)² · σa² = ¼ · t4 · σa²

Note that the uncertainty depends on the time t.


Let the acceleration be a = 4 m·s-2 with σa = 0.3 m·s-2, and the duration be t = 3 s. We then get:

s(t) = 18 m
σa = 1.8225 m

so that the relative error σ/s is 10.1%.

If we change t = 0.7 s, then we would get

s(t) = 0.98 m
σa = 5.402E-3 m

so that σ/s = 0.6%.

What does this mean? For short durations/distances, even large errors make for fairly accurate results. You might just as well ignore them. However, the error grows in O(t4), which is quite fast. So over a longer distance/duration, you tend to get very uncertain results (which may still be useful, depending on the problem domain).

We can calculate the distances or times where the σ/a -ratio stays within a certain value p:

p ≥ (¼ · t4 · σa²) / (½ a · t²) = ½ · σa²/a · t²
t ≤ √( 2 · p · aa² )

So with the previous values for acceleration and deviation, and a limit for p at 5%, we now know that any extrapolations longer than t = √4.44 s = 2.11 s (equivalent to a distance of 8.89 m) are too uncertain.

For further reading, you should look at Propagation of Uncertaincy at Wikipedia.


Accuracy of the measurement will be specific to the device you are using and the chips used to create the sensor.

Accuracy (precision) of the calculation will be dependent upon the variable types (int, float, double, etc...) that you use.

Accuracy of the integration you are suggesting to calculate distance will depend upon how many samples you are able to gather, the frequency of those samples, and the accuracy of the samples themselves.

Your question is a minor example of the compounding error problem. You are most likely limited by the sensor reading. All of the subsequent operations upon that reading / those readings will compound that error.

Your best bet is to take a lot of readings and see how close they match your expectations for what you need it to do.

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