Signal Vector Magnitude - Accelerometer MPU6050

Hello, I'm creating a kind of pedometer on a bracelet with an MPU6050 accelerometer, and for that I'm relying on the following code Pedometer/Pedometer.ino at master · Perseus14/Pedometer · GitHub . I managed to make the code work, but I am in doubt in the following calculation made in the algorithm:

int mag = sqrt (pow (x - angle_x, 2) + pow (y - angle_y, 2) + pow (z - angle_z, 2)); (A)

In this line of code that I put he calculates the vector of magnitude of the signal, but to make this calculation x, y and z are equivalent to the previous angles already obtained and angle_x, angle_y, angle_z balance the current ones. My question is related to this subtraction of values, because the formula for calculating the magnitude vector of the sign is as follows:

int mag = sqrt (pow (x, 2) + pow (y, 2) + pow (z, 2)); (B)

Can anyone understand why the values were subtracted in the first formula (A) before calculating the signal magnitude vector?

Thank you!

It’s a distance calculation (norm) measuring the magnitude of the change

Formula (A) makes no sense for angles. 3D angles do not add or subtract, either linearly or in quadrature.

jremington:
Formula (A) makes no sense for angles. 3D angles do not add or subtract, either linearly or in quadrature.

Well, You have a point in a 3D space at some instant and another point a bit later.

In the general case You can compute a mathematical distance between those two points - which is the formula - and OP question.

For small movements on a system attached to an operator and not involving wrapping (going from 359.9º to 0.1º) the distance will provide some reasonable first hint at some system changes which I suppose this is what’s done there.

I agree though that’s pretty poor input for a pedometer