A question jumped into my head while processing data from MEMS sensors and Vicon: Is there any better ways of estimating first-order derivative of a function using samples at a fixed time interval, i.e. a “table”?

To be precise, suppose we have a function $$f\left( t \right)$$ which is smooth enough, and a series of samples $$\left( t_i, y_i = f\left( t_i \right) \right), i = 1,2,3\dots$$ where $$t_{i+1} – t_i = \Delta t = \text{Const.}$$.

The most intuitive way would be:

\[f’ \left( t_i \right) \approx \frac{y_{i+1} – y_i}{\Delta t} \]

By looking into the Taylor Series, we found that the estimation error is the same order of $$\Delta t$$:

\[f\left(t_{i+1}\right) = f\left( t_i \right) + f’\left(t_i \right) \Delta t + \frac{f”\left( t_i \right)}{2} \Delta t^2 +\frac{f”’\left( t_i\right)}{6} \Delta t^3 + o\left(\Delta t^3\right)\]

\[\frac{y_{i+1} – y_i}{\Delta t} – f’\left( t_i \right) = \frac{f”\left( t_i \right)}{2} \Delta t + o\left( \Delta t \right) \]

But if we examine another Taylor Series,

\[f\left(t_{i-1}\right) = f\left( t_i \right) -f’\left(t_i \right) \Delta t + \frac{f”\left( t_i \right)}{2} \Delta t^2 -\frac{f”’\left( t_i\right)}{6} \Delta t^3 + o\left(\Delta t^3\right)\]

it is obvious that we can eliminate the $$\frac{f”\left( t_i \right)}{2} \Delta t^2$$ term by subtracting $$f\left(t_{i-1}\right)$$ from $$f\left(t_{i+1}\right)$$:

\[y_{i+1} – y_{i-1} = 2f’\left(t_i \right) \Delta t + \frac{f”’\left( t_i\right)}{3} \Delta t^3 +o\left(\Delta t^3\right)\]

Thus obtaining an estimation with error which is the same order of $$\Delta t^2$$:

\[\frac{y_{i+1} – y_{i-1}}{2\Delta t} -f’\left(t_i \right) =\frac{f”’\left( t_i\right)}{6} \Delta t^2 +o\left(\Delta t^2\right)\]

So,

\[f’ \left( t_i \right) \approx \frac{y_{i+1} – y_{i-1}}{2\Delta t} \]

seems to be a better estimation. But it depends on the smoothness of $$f\left( x\right)$$ as it is possible that $$f”’\left( t_i\right)$$ is much larger than $$f”\left( t_i\right)$$.