I just have three arrays of acceleration values that are labeled, let's say, a_x, a_y and a_z.
How could I integrate those arrays to get arrays of position values?
I just have three arrays of acceleration values that are labeled, let's say, a_x, a_y and a_z.
How could I integrate those arrays to get arrays of position values?
If you are using numpy, the column_stack() method is convenient:
import numpy as np
a_x = np.array([1, 2, 3])
a_y = np.array([4, 5, 6])
a_z = np.array([7, 8, 9])
positions = np.column_stack([a_x, a_y, a_z])
print(positions)
returns:
[[1 4 7]
[2 5 8]
[3 6 9]]
or, with lists and a loop:
a_x = [1, 2, 3]
a_y = [4, 5, 6]
a_z = [7, 8, 9]
_positions = []
for i in range(len(a_x)):
_positions.append([a_x[i], a_y[i], a_z[i]])
print(_positions)
returns:
[[1, 4, 7], [2, 5, 8], [3, 6, 9]]
I hope this is what you were looking to do :)