I'm trying to remove the drift generated upon the double integration of a noisy acceleration signal. But this question discusses only removing the drift upon single integration to generate velocity signal.

I'm following this research paper which uses Envelope method to remove the drift generated upon double integration of a signal.

TLDR Envelope Method for a given discrete signal $x(n)$:

  • Identify all the local extrema of $x(n)$
  • Interpolate between maxima (resp., minima) by a cubic spline to form the upper envelope $e_{u}(n)$ (resp., the lower envelope $e_{d}(n)$)
  • Calculate the mean of the envelopes $e_{a}(n) = (e_{u}(n) + e_{d}(n))/2$
  • Compute $y(n) = x(n) - e_{a}(n)$

Example I was trying to solve using envelope method

t = np.arange(0, 20, 0.1)
f1 = lambda t: 0.1*np.sin(np.pi*t) + 0.1*np.sin(20*np.pi*t) #Clean accleration signal
f2 = lambda t: 0.1*np.sin(np.pi*t) + 0.1*np.sin(20*np.pi*t) + 0.01 #Noisy acceleration signal

enter image description here

Upon Single integration for velocity:

enter image description here

Then located maxima and minima and performed cubic interpolation to generate upper and lower envelopes respectively using CubicSpline Method from the scipy package.

enter image description here

Then Generated mean of the envelopes:

enter image description here

Then Subtracting the mean of the envelopes from the Drift prone velocity: enter image description here

I don't know what I did wrong but as it can be seen in the final plot, clean signal of velocity does not match the noisy signal corrected using the envelope method. I know there are other/better methods for correcting the baseline offsets but as starting point, the envelope method seemed easier to implement. If there are methods better than this and easier to implement, I'm all ears.

I would like to know what mistake I made along the way.



1 Answer 1


It looks like you are adding a constant for noise, so it makes sense the envelope output is a constant offset from the clean. I would think you need to add gaussian noise to simulate more realistic noise. Guassian noise would be centered around the clean signal.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.