ChuDaidai,
Replace the words "work well" with "work better" and it would be closer to the truth. We are working on an addition that will allow you to calibrate out post-board mount offset of an accelerometer at 1 temperature. BUT you still have the effects of random noise in the accelerometer output. Integrating random noise creates something called "random walk".
In the figure below, I took noise and post-board-mount offset numbers from the MMA8451Q datasheet. I modelled 20mg offset all in the X axis. Noise in both X and Y. After 5 seconds, we have greater than 60cm error in X and about 2mm error in Y. The X error can be cut down to approximate the Y error by calibrating the accelerometer after the PCB is populated. There's nothing you can do about the noise terms.

With offset reduced to 1 microG, the curve looks like:

But again, this is using a single-temperature offset correction. Variations in temperature will cause the terms to increase.
I've included the Matlab script that computed the first graph below, so you can play with it yourself.
Mike
close all;
runs = 10; %% Number of runs to simulate
g = 9.80665; %% 1 g = 9.8 meters/sec/sec
N = 126e-6; %% MMA8451Q Noise = 126 micro-g per root Hz
O = [0.02, 0]*g; %% MMA8451Q Post-board mount offset = +/- 20mg (modeled as all in X)
fs = 400; %% sample rate
dt = 1/fs; %% sample interval
NS = 1000; %% Number of samples to simulate (5 seconds here)
bw = sqrt(fs); %% bandwidth
n = N * g * bw; %% Noise per sample
v = 0; %% velocity in meters/second
cols = 1:2;
for i=1:runs
v(1,cols) = [0, 0]; %% 2D velocity in meters/second
a(1,cols) = [0, 0]; %% 2D acceleration in meters/second/second
p(1,cols) = [0, 0]; %% 2D position, X & Y in meters
for j = 1:NS
time(j)=j*dt;
r1 = 2*rand-1; %% A number between -1 and 1
r2 = 2*rand-1; %% A number between -1 and 1
a(j,cols) = [r1*n, r2*n] + O; %% measured acceleration noise
if (j>1)
%% now do the double integration
v(j,cols) = v(j-1,cols) + 0.5*dt*(a(j-1,cols)+a(j,cols));
p(j,cols) = p(j-1,cols) + 0.5*dt*(v(j-1,cols)+v(j,cols));
end
end
plot(p(:,1), p(:,2)); hold on;
title('Position over time');
xlabel('X displacement in meters');
ylabel('Y displacement in meters');
end