'Displacement and Velocity in a Single Direction from Apple Core Motion

I am working on a project and need to find velocity and displacement in a single direction (that direction being straight up and down). I am using my Apple Watch and retrieving all of the Core Motion data from this. I understand that there is drift when integrating the acceleration which can create highly inaccurate displacements. Although through my research, I have read that if you constrain the motion to just one direction you can get better results.

If I would like to find velocity and displacement in only one direction will that truly give me better results? If so, how is this constraining actually done mathematically?

All the work I have done so far is to find the resultant direction of the acceleration from userAcceleration and while looking into the best way to integrate came across this displacement drift issue and wanted to find a path forward.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source