Common approach on computing derivative of a noisy function numerically is similar to classic central differences we considered before. We approximate “difficult” by a polynomial near point of interest and assume that is equal (with some deviance) to the derivative of that polynomial.
Only one important change is required – method of approximation. In case of noisy data there is no sense to use interpolation as we do for central differences (values are already corrupted by noise, no need to preserve them precisely). Instead smoothing least-squares approximation is used in order to remove noise from the data. Filters derived by this procedure are commonly referenced as Savitzky-Golay digital differentiators. We will consider several particular filters of this class named after Cornelius Lanczos. Detailed procedure is described below (skip to the final formulas).
Analogously to central differences, we fix some step and sample at (odd) points around :
Then we construct approximating polynomial for by minimizing cost function
with respect to unknown coefficients . To do this we need to solve system of linear equations:
Once polynomial is constructed we can estimate following to our assumption:
Power of the polynomial should be strictly less than otherwise least-squares approximation will be equivalent to interpolation (number of unknowns will be equal to number of freedom degrees) and we will arrive to central differences.
Methods derived by this procedure are called low-noise Lanczos differentiators for and super Lanczos low-noise differentiators for . In general
These differentiators have very simple structure and can be written in general form for any :
Interesting fact is that denominators constitute special sequence of integer numbers appeared in many fields of mathematics and physics. For example, these numbers are coincide with maximum accumulated number of electrons at energy level . Check this website for more details.
To differentiate a digital signal we need to use h=1/SamplingRate and replace by in the expressions above. Magnitude responses of low-noise differentiators for are drawn below:
As it can be clearly seen this method is much more robust to noise than plain central differences. However due to least-squares nature Lanczos differentiators cannot guarantee complete noise suppression in high frequencies. Its magnitude response doesn’t go smoothly to zero near . Instead they resemble “wavy” always-non-zero response on high frequencies.
Filters with guaranteed suppression of noisy high frequencies are presented in the next article:
You can use materials from this site in any legal activity (research, teaching, engineering, etc.) freely on the basis of respecting my authorship by giving clear statement and reference to my site or particular page on it in your work. Besides brief description of your project is very welcome in the comments below. One point though, if you use my materials in commercial project please consider supporting my site and me by donation.