I have some smartphone recorded accelerometer data, so I have acceleration along 3 axes: $$a_{x}, a_{y}, a_{z}$$

The accelerometer data was collected by securing a phone to a walking subject. I'm primarily interested in being able to identify the time between each step they took. Normally, I could just search for peaks in the vertical acceleration vector, but in this case I don't know the orientation of the phone during the walk so I cant be sure which axis the vertical movement is coming in on

Individually, the 3 signals dont tell me anything useful because of the orientation problem, so I'm trying to condense them into a single vector. Presumably walking steps will cause the largest change in acceleration, so I can just time the peaks in this combined signal. Ultimately I'm looking to create a vector that will tell me the amount of total acceleration at each time point of the walk.

I've seen some people apply the following:

$$A = \sqrt{a_{x}^2 + a_{y}^2 + a_{z}^2}$$

A few questions about this:

  1. What is the correct name for the resulting vector? I've heard it referred to as magnitude of acceleration, but when I google that term I see that its calculated as the following and unsure if they're referring to the same thing: $$\Delta v/\Delta t$$
  2. If I wanted to calculate that value in Python, would it be as simple as taking each acceleration vector, element-wise square each one, element-wise sum the 3 vectors together, then take the root of each individual element? I know this is just the Pythagorean theorem, but unsure how to apply it in the case of vectors. Should the result be a vector?
  3. How would you interpret the resulting value? Would it be the total amount of acceleration at each time point?
  4. Given my goal of identifying time between steps, is this an appropriate approach? Or is there a more preferred way of combining the 3 acceleration signals?

1 Answer 1

  1. Your expression $A=\sqrt{a_x^2+a_y^2+a_z^2}$ calculates the length of the 3-dimensional vector with coordinates $(a_x, a_y, a_z)$. So, it is the magnitude of the acceleration. Your expression $a=\Delta_v/\Delta_t$ also gives magnitude of acceleration, but in a slightly different context. This comes from measuring speed at different times, and then you average the acceleration between the time steps. You can ignore this expression for your case.

  2. given ax, ay, az are $N$-dimensional vectors that contain the measurements of $a_x, a_y, a_z$ over time, you would do A=np.sqrt(ax**2+ay**2+az**2) to calculate the magnitude over time.

  3. Yes, it's the overall acceleration at every time point. Though, it is only a relative value, its unit will not be exactly $m/s^2$, but there is some scaling involved to transform your measurement $A$ to the common $m/s^2$ units. Though, you don't need to do it, since you are only interested in relative changes of the acceleration over time.

  4. Looks reasonable. Just plot $A$ vs time for some steps and decide on your own, if your measurement would contain sufficient information.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.