Accelerometers non linear, trying to get position

Hello, i got an adxl335 as an accelerometeters. My fonction voltage(acceleration) is non linear but it's bijective.
So i wrote a code with conditions on voltage to get the right acceleration.

I did a double integration of acceleration to get position nevertheless i feel like my result are random.

In fact, did several test and i never managed to get the same position.

So i checked the voltage, i moved from left to right and from right to left the device while printing the voltage on Matlab and then surprisingly when i moved the device from left to the right, the voltage was increasing or decreasing but randomly. Same thing when i move it from right to left side....

In my opinion, it should increase or decrease for a specified direction.

What do you guys think of it?

Thank you in advance

The position errors in consumer-quality accelerometers accumulate so rapidly that you are likely to see errors of many kilometers in just a few minutes.

What you are attempting to do simply cannot be done without a military budget. Think of another way to do it.

My fonction voltage(acceleration) is non linear

Unlikely, or you are reading the voltage incorrectly. More likely, you don't know what the actual values of the acceleration are.

Read this overview to learn why your method of calculating position won't work:

I've never used an accelerometer...

But "philosophically", the problem is when acceleration is small... If you speed-up, slow-down, or change directions slowly/gently... you'll read almost zero acceleration and your readings will be dominated by noise (randomness).

the problem is when acceleration is small

In some cases, yes.

In case of horizontal motion, the largest problem is knowing the orientation of the accelerometer accurately enough that the acceleration due to gravity can be subtracted without introducing large errors.

This is explained very clearly here.