I make a derivative computation on sinusoidale signal. I make simple python program to test it:
signal = np.sin(time_s.to_numpy())
for index in range(1, len(signal)-1):
first[index] = signal[index ]-signal[index -1] /(2*dt) * 100
second[index] = signal[index+1 ] - 2*signal[index ]+signal[index -1] /(dt*dt)
signal_display[index] = signal[index ]* 2000
My first derivative function should like a cosinus?
You are missing parentheses in the numerator of your derivatives, and you are scaling them inappropriately. They should look like this:
first[index] = (gyroX_filtered[index] - gyroX_filtered[index - 1]) / dt
second[index] = (gyroX_filtered[index + 1] - 2 * gyroX_filtered[index] + gyroX_filtered[index - 1]) / dt**2