Darlan Candiotto
Darlan Candiotto

Reputation: 31

Signal Vector Magnitude - Accelerometer MPU6050

I'm creating a kind of pedometer on a bracelet with an MPU6050 accelerometer, and for that I'm relying on the following code https://github.com/Perseus14/Pedometer/blob/master/Pedometer.ino . 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!

Upvotes: 0

Views: 633

Answers (1)

Túlio Rossi
Túlio Rossi

Reputation: 60

I thing this is beeing used to calculate the accelarion variation... And than is basicly the derevative.

When you derivate a position you get the velocity. When you derivate the velocity you get the acceleration.

(Considering time constant is "1").

Upvotes: 1

Related Questions