Acceleration to velocity - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Data Science (https://python-forum.io/forum-44.html) +--- Thread: Acceleration to velocity (/thread-37189.html) |
Acceleration to velocity - frohr - May-10-2022 Hi, I want to ask you if I have correct calculation of velocity fom acceleration. It is for vibration analysis. I have ADXL1005 and I acquire data to buffer with sampling frequency 30000. Acceleration must be from 10 to 1000Hz. Now I have array in Python and calculation. But I am not sure if this method correct. def mm_RMS(self): accelerationl[0:30000] = read_adxl[0:30000] velocity = 0 speed_mm = 0 time_mm = 0 velocity_tot = [] lowcut = 10.0 highcut = 1000.0 get_mms = butter_bandpass_filter(acceleration, lowcut, highcut, 30000, order=4) for i in range(0, 30000): velocity = speed_mm + (acceleration[i] * time_mm) speed_mm = velocity time_mm = time_mm + 1/30000 velocity_tot.append(velocity ** 2) tot_mm = sum(velocity_tot) tot_mm = tot_mm / 30000 tot_mm = math.sqrt(tot_mm) print("mm/s: " + str(round(tot_mm,2)))I am not sure, maybe is much better method. Thanks for any advice. RE: Acceleration to velocity - deanhystad - May-10-2022 If you just want to know the velocity at the end of your sample: velocity += sum(acceleration) / 30000Just like you were doing for displacement. If you want a velocity for each acceleration point, I would use numpy.trapz() https://numpy.org/doc/stable/reference/generated/numpy.trapz.html You could do this again to get a time history of displacement. |