# Smoothing the discrete acceleration

In order to know if my signal is increasing or decreasing, I'm using the discrete derivative $$y[n] = x[n] - x[n-1]$$ or a smoothed version of it (for example Exponential Weight Moving Average of $$y[n]$$ that gives a "smooth" version of the derivative).

Now to make further analysis, I also want to consider the discrete acceleration:

$$z[n] = x[n] - 2 x[n-1] + x[n-2]$$

But as the signal is sometimes a bit noisy, I wanted to study a smoothed version of this acceleration. I thought about :

• Standard Moving average of $$z$$ : $$SMA(z[n], 10)$$. Easy computation shows that $$SMA(z[n], 10) = \frac{1}{10} (x[n]-x[n-1]-x[n-10]+x[n-11])$$

It's not so good because it uses too few values of x[k]...

• Exponential Moving average of $$z$$ : $$EMA(z[n], 10)$$. Computations shows that: $$EMA(z[n], 10) \approx 0.09 (x[n] - x[n-1])$$ and this is proportionnal to ... derivative !

Indeed, all the next coefficients are negligible $$\ll 10^{-3}$$.

This is strange: I expected the the Exponential Moving Average of the acceleration to be smoother but it turns out that it nearly uses only 2 values : $$x[n]$$ and $$x[n-1]$$. (See below the impulse reponse of EMA of acceleration).

# Question:

How to get a "smoothed" version of discrete acceleration, as $$A[n] = a_0 x[n] + a_1 x[n-1] + ... + a_k x[n-k]$$ ?

Remark: Impulse reponse of EMA of discrete acceleration:

• What EMA with what $\alpha$'s did you use to smooth the derivative ? Jan 12, 2016 at 11:31
• You should have a look into Savitzky-Golay filters. Jan 12, 2016 at 11:37
• @Gilles : I used $\alpha = 1/(1+10)=1/11$ to smooth the derivative. When using same $\alpha$ with EMA to smooth the acceleration, I get this weird result : smoothed acceleration $\approx c (x[n] - x[n-1])$ !
– Basj
Jan 12, 2016 at 11:58
• @MattL. : I didn't know. Why specifically these filters, and not another? (Kalman) etc. Can you develop into an answer?
– Basj
Jan 12, 2016 at 12:00
• Savitzky-Golay filters work very well for smoothing data, or smoothing derivatives of data. Have a look at this answer (this is not about derivatives though). This question is very similar to yours. Jan 12, 2016 at 13:17