The most common way of computing numerical derivative of a function at any point is to approximate by some polynomial in the neighborhood of . It is expected that if selected neighborhood of is sufficiently small then approximates near well and we can assume that .
Let’s consider this approach in details (or go directly to the table of formulas).
At first, we sample at the ( is odd) equidistant points around :
where is some step.
Then we interpolate points by polynomial of degree: . Its coefficients are found as a solution of system of linear equations:
By our assumption can be approximated by the derivative of the constructed interpolating polynomial:
To illustrate the process let’s consider case when . Here interpolating parabola are defined by the system (we assume for simplicity):
After subtracting first equation from the last we get final result:
In the same way we can obtain expressions for any . Formulas for are listed below:
These expressions are very widely used in numerical analysis and commonly refered as central(finite) differences. As it can be clearly seen they have simple anti-symmetric structure and in general difference of -th order can be written as:
where are coefficients derived by procedure described above.
It is easy to see that if is a polynomial of a degree , then central differences of order give precise values for derivative at any point. This follows from the fact that central differences are result of approximating by polynomial. If is a polynomial itself then approximation is exact and differences give absolutely precise answer.
To differentiate a digital signal we need to use h=1/SamplingRate and replace by in the expressions above. In this case derivative of a signal is found by
Frequency response of central differences is:
Magnitude responses for are drawn below:
Red dashed line is the magnitude response of an ideal differentiator . As grows moves closer to ideal differentiator response (by increasing tangency order with at ).
In practice there is no need for ideal differentiators because usually signals contain noise at high frequencies which should be suppresed. This means that response of practical differentiator should be close to on some passband interval and should tend to zero in the upper part of Nyquist interval .
From the plot we can see that central differences don’t resemble such behavior, all they care about is to get as closer as possible to the response of ideal differentiator, without supression of noisy high frequencies. As a consequence they perform well only on exact values, which contain no noise. Different technique is needed for robust derivative estimation of noisy signals. Such approaches are considered in the next sections: