# How to find smoothed estimates of the derivative and second derivative of a signal?

I have a signal sampled at $\Delta t$: $f_i(t_i=i\Delta t)$ where $i = 0,\ldots,n-1$. I want to find the first and second derivative of the signal: $f'(t)$ and $f''(t)$.

My first thought was to estimate the derivatives by central differences:

\begin{align} f'(t_{i})&=\frac{f(t_{i+1})-f(t_{i-1})}{2\Delta t}\\ f''(t_{i})&=\frac{f(t_{i+1})-2f(t_{i})+f(t_{i-1})}{(\Delta t)^2} \end{align}

However the signal may have a lot of high frequency noise that may cause quick fluctuations in $f'$ and $f''$.

What would be the best way to find "smoothed" estimates of $f'$ and $f''$?

Can you post some pictures or more information about the signal you want to differentiate? Probably what you're looking for is some sort of lowpass filter to smooth the signal. A couple really simple options include a single-pole recursive filter like $y(n) = a \cdot x(n) + (1-a) \cdot y(n-1)$, or a Hann filter, which is just convolving the signal with a Hann window. The Hann filter option is nice because it's linear-phase. If you know the frequency range you care about, you can just design a suitable lowpass filter in the frequency domain.