I'm working on an inertial measurement project using a 3-axis accelerometer and an Arduino. I want the Arduino to take in the x, y, and z g-values and spit out the magnitude. Since the |a| = sqrt(x^2 + y^2 + z^2) is computationally expensive, I wanted to investigate whether there was an alternative algorithm that could be used to speed it up (I'm willing to sacrifice a little accuracy).
I read about the Alpha-max, Beta-min method, but that appears to only work for 2D vectors. Is there anything similar for 3D vectors?
EDIT: Program language is C++
Calculate the magnitude of three dimensional vectors (3D Vectors) for entered vector coordinates. The 3D vectors are using the x-y-z axes. The vector OP has initial point at the origin O (0, 0, 0) and terminal point at P (2, 4, 5). So we can draw the vector OP.
RaddyRaddy
1 Answer
If you have a fast way of calculating
two-dimensional
magnitude, then perhaps the three-dimensional
magnitude can be restructured in those terms. The three-dimensional magnitude can be derived from thePythagorean theorem.
![Magnitude Of A 3d Vector Magnitude Of A 3d Vector](http://adaptivemap.ma.psu.edu/websites/vectormath/vectors/images/3D1.png)
MattHMattH