I'm trying to write a code for a drop test that will take acceleration data and integrate to find velocity then further integrate to find height over time. I'm running into an issue with cumtrapz that even when I give the integral an initial value for my height, say 0.3m, it places that as the first value in the returned array but does the rest of the integration from 0. Here is the section of the code I'm talking about:
#integrate velocity values to get distance values
h_0=float(input("Initial Height(m): "))
x_dist = cumtrapz(x_vel, x=time, initial=0)
y_dist = cumtrapz(y_vel, x=time, initial=0)
z_dist = cumtrapz(z_vel, x=time, initial=h_0)
And here is the result I am getting for the height along the z-axis when inputting 0.3m as my initial height.
Am I using cumtrapz wrong or will I have to just manually add the offset after the fact?