TestProj

Last updated: September 23rd, 20192019-09-23Project preview
In [46]:
import pandas as pd

Calculating the magnitude of the acceleration against gravity

[WIP] Calculation approach 1: Using the dot product of the gravity vector and the user initiated acceleration vector

Assumptions

This approach assumes that the magnitude of the gravitational vector will be 1G (or at least very close to 1G, since noise in the system might not yield exactly 1G). For example if the components of the gravitational vector are: [-2.26, 3.96, 8.69] then the magnitude is $\sqrt{-2.26^{2} + 3.96^{2} + 8.69^{2}}=9.81 = 1G$.

Example calculation for a single sample

Given that the User Initiated Acceleration vector is:

In [47]:
userInitiatedAcceleration = pd.Series([7, 5, 6,]) 

And the Gravitational acceleration vector (measured in G = 9.81)

In [48]:
G = 9.81
gravitationalVector = pd.Series([2.26/G, 3.96/G, 8.69/G]) 

Then the magnitude of the acceleration against gravity will be the dot product of the userInitiatedAcceleration and the gravitationalVector

In [50]:
# WIP, the signs of the vectors probably needs to be taken into account
dotProduct = userInitiatedAcceleration.dot(gravitationalVector)

# display 
print('dotProduct = {} m/s2'.format(dotProduct)) 
dotProduct = 8.945973496432211 m/s2
In [ ]:
 
Notebooks AI
Notebooks AI Profile20060