For the purpose of this question, let's say that I have an accelerometer that is on a foot of a human. ( red square on by the heel in the below photo )
I'd calculate the angle the following way, as the leg goes from step 1 to step 2.
$\theta = tan^{-1}(\frac{x}{y})$
At step 1, the angle would be $0$, as $y = -1$ and $x = 0$. As the leg moves towards step 2, it would come closer and closer to $90^{\circ}$. If the leg could be raised enough to be parallel to the waist, it would be a full $90^{\circ}$, given the assumption that if $y == 0$, the result equates to $90^{\circ}$.
Now that I have illustrated what I am doing, I am curious to monitor what happens on the z axis. The base assumption thus far has been that the person will go from Step 1, to Step 2, and not swing their leg back and forth. So what I want to do is, as the person is moving their leg, I want to measure the angular change on the Z axis. i.e Is the person moving their leg back and forth while going from Step 1 to Step 2.
This has me a bit stumped at the moment, because I do not know which of the other two axis I should use to determine the change in angle on the Z axis. I'd expect to see the following:
As the person moves the leg back over time, but continues from step 1 to step 2, that the angle goes from $0^{\circ}$ to $-90^{\circ}$. As the person moves the leg forwards, but continues from step 1 to step 2, that the angle on the z axis goes from $0^{\circ}$ to $90^{\circ}$.

