# How do I get the total acceleration from 3 axes, in negative?

For a project, I'm working with acceleration data recorded by triaxial accelerometers. This means that I have accelerations in the x, y, and z axes. I found the almost exact same question from a few years back: How do I get the total acceleration from 3 axes?. This gives a fairly easy function which indeed gives the total acceleration: $$\sqrt(a_x^2+a_y^2+a_z^2)$$

There is only one issue here that I cannot seem to solve myself. I need to use the total acceleration in order to calculate Metabolic Power. Without going into too much detail on what Metabolic Power is, there are two separate equations for both positive and negative acceleration, negative essentially being deceleration. However, when using the function above, it will always give a positive value since you square the accelerations, even if they are negative. Is there any way this function can be altered so that it also works for decelerations, or is there another function for this? Thank you.

• Welcome to Physics! By "positive acceleration" and "negative acceleration", do you effectively mean "acceleration in the direction of the velocity" and "acceleration opposite the direction of the velocity"? If so, you'll need to have velocity data as well; do you have that? Nov 8 '21 at 14:53
• (If not, it can be inferred from the acceleration data so long as you have that in a time series, but it'll be trickier) Nov 8 '21 at 14:54
• @MichaelSeifert Thank you for your response! I must say that I'm unfortunately not too sure, I was given the data without much explanation. I'm also not a student in physics, but in data science, so I might sometimes have some troubles exactly understanding everything. I assumed that when the acceleration in a certain axes is negative, it means that the person is slowing down in that direction. Reading medium.com/intro-to-artificial-intelligence/…, I think your statement might be right, but I'm not sure.
– T E
Nov 8 '21 at 15:38
• I do not have data on velocity, but I do have GPS coordinates, speed and gyroscope data in X, Y and Z axes, so I'm sure it can be derived somehow. It might indeed get a little tricky though.
– T E
Nov 8 '21 at 15:38

If you know the $$x$$-, $$y$$-, and $$z$$-components of the velocity of the object, then the quantity which will tell you whether the object is "speeding up" (positive acceleration) or "slowing down" (negative acceleration) is $$a_v = \frac{\vec{a} \cdot \vec{v}}{|\vec{v}|} = \frac{a_x v_x + a_y v_y + a_z v_z}{\sqrt{v_x^2 + v_y^2 + v_z^2}}$$ What this does is to find the component of the vector $$\vec{a}$$ in the direction of the velocity $$\vec{v}$$. This quantity also turns out to be equivalent to $$a_v = d|\vec{v}|/dt$$, i.e., the rate of change of the object's speed. (The proof is left as an exercise for the reader.) If this quantity is positive, then the object is "speeding up", and $$a_v$$ is the rate at which its speed is increasing. Similarly, if $$a_v$$ is negative, the object is "slowing down"; and if $$a_v$$ is zero, then its speed is not changing.

(This last case could mean the object is at rest, but it could also mean that it's moving along a curving path with constant speed but changing direction. I'm not sure what your model predicts about metabolic power in such cases.)

I think you need to work on defining your problem a bit more or you have defined things incorrectly.

If your metabolic equation only accepts acceleration as a single positive or negative number, it must be assuming some axis to work along, and that axis need not be x, y, or z. Or you are working with an inappropriate single axis form of the equation and a 3D vector form of the equation exists which you should be using.

$$\vec a=a_x\vec i + a_y\vec j +a_z\vec k = $$

that give the total acceleration in both magnitude and direction.

If you want to separate magnitude, which is always positive, the equation you posted gives that:

$$|\vec a|=\sqrt(a_x^2+a_y^2+a_z^2)$$

If you want to separate direction, you calculate unit vector, which gives direction with no magnitude (or rather, has a magnitude of 1 so can be multiplied without changing the magnitude):

$$\hat a=\frac{\vec{a}}{\sqrt(a_x^2+a_y^2+a_z^2)} = \frac{a_x\vec i + a_y\vec j +a_z\vec k}{\sqrt(a_x^2+a_y^2+a_z^2)}=\frac{a_x}{\sqrt(a_x^2+a_y^2+a_z^2)}\vec i+\frac{a_y}{\sqrt(a_x^2+a_y^2+a_z^2)}\vec j+\frac{a_z}{\sqrt(a_x^2+a_y^2+a_z^2)}\vec k=<\frac{a_x}{\sqrt(a_x^2+a_y^2+a_z^2)},\frac{a_y}{\sqrt(a_x^2+a_y^2+a_z^2)},\frac{a_z}{\sqrt(a_x^2+a_y^2+a_z^2)}>$$

Therefore magnitude $$|\vec a|$$ alongside unit vector $$\hat a$$ give the same information as your xyz vector $$\vec a$$ but in a separated form.

You ask for positive or negative total acceleration which sounds like your problem is incorrectly defined. The only way to have a total acceleration that is just a positive or negative number is to define it along some (potentially arbitrary) axis.

So if you want that then you need to define what that axis is in terms of a unit vector I will refer to as:

$$\hat q = t\vec i + u\vec j +v\vec k = $$

Since an arbitrary acceleration in 3D space won't necessarily always be aligned with your unit vector of interest, then you need to dot product your acceleration vector with that unit vector to find the projection; That is, the magnitude of the component of the acceleration which is parallel to, or along your direction of interest:

$$\vec a \cdot \hat q = a_x t + a_y u +a_z v$$

The direction associated with this projection is the unit vector $$\hat q$$. The sign of the resulting number tells you in which direction along the q-axis that the projection is pointing while the number itself is the magnitude. I assume this is what you need.