Figure 2. Errors due to sampling a periodic signal and approximating by linear interpolation
The interpolated function value,fint(xk) can be derived by considering it as a point of division, i.e. it divides in a ratio of(xk-xi) :(xi+1-xk) the join of points (xi , f(xi) ) and (xi+1 , f(xi+1) ):
\(f_{\text{int}}\left(x_{k}\right)=\frac{\left(x_{i+1}-x_{k}\right)f\left(x_{i}\right)+\left(x_{k}-x_{i}\right)f\left(x_{i+1}\right)}{x_{i+1}-x_{i}}\)(4).
Accordingly, the sampling error at this epoch becomes
\(\varepsilon_{k}=f\left(x_{k}\right)-f_{\text{int}}\left(x_{k}\right)=f(x_{k})-\frac{\left(x_{i+1}-x_{k}\right)f\left(x_{i}\right)+\left(x_{k}-x_{i}\right)f\left(x_{i+1}\right)}{x_{i+1}-x_{i}}\)(5).
Note that the difference of two consecutive abscissae (in the denominator of the second term of the righthand side) is the sampling interval, \(T=x_{i+1}-x_{i}\).
Generally, the sampling error in the engineering practice is estimated by L2-norm; for some applications also L1-norm and L-norm is used. The present study focuses on the L2-norm, which is derived after the simpler form of L1-norm. The L1-norm of the sampling error over the [xi , xi+1 ] interval can be defined as it is the mean of the \(\varepsilon\) differences at all epochs, i.e.
\(\sigma_{L1}\left([x_{i},x_{i+1}]\right)=\frac{L1\left([x_{i},x_{i+1}]\right)}{n}=\frac{\sum_{x_{i}}^{x_{i+1}}\left|\varepsilon_{k}\right|}{n}=\frac{\int_{x_{i}}^{x_{i+1}}{\left|\varepsilon(x)\right|\text{dx}}}{T}\)(6).
The integral provides the area between the real and interpolated curves, which is then subsequently divided by the sampling interval. By rigorous calculus, a closed-form for the L1-norm (inserting (3) and (5) to (6)) can be derived by solving the definite integral of
\(\sigma_{L1}\left([x_{i},x_{i+1}]\right)=\frac{\int_{x_{i}}^{x_{i+1}}{\left|Asin(2\pi\omega\ x+\phi)-\frac{\left(x_{i+1}-x\right)Asin(2\pi\omega\ x_{i}+\phi)+\left(x-x_{i}\right)Asin(2\pi\omega\ x_{i+1}+\phi)}{T}\right|\text{dx}}}{T}\)(7),
resulting in
\(\sigma_{L1}\left([x_{i},x_{i+1}]\right)=\left|C\bullet\cos\left(2\pi\omega x_{i}+\phi\right)+S\bullet sin(2\pi\omega x_{i}+\phi)\right|\)(8),
where
\(C=\frac{A}{2\pi\omega T}-\frac{A}{2}sin(2\pi\omega T)-\frac{A}{2\pi\omega T}\cos\left(2\pi\omega T\right)\)(9)
and
\(S=-\frac{A}{2}+\frac{A}{2\pi\omega T}\sin\left(2\pi\omega T\right)-\frac{A}{2}cos(2\pi\omega T)\)(10).
For details of deriving (8), see Appendix A. By introducing the following notation
\(n=2\pi N=2\pi\omega T\) (11)
it simplifies to
\(C=\frac{A}{n}-\frac{A}{2}sin(n)-\frac{A}{n}\cos\left(n\right)\)(12)
and
\(S=-\frac{A}{2}+\frac{A}{n}\sin\left(n\right)-\frac{A}{2}cos(n)\)(13).
Using the\(C\bullet\cos\left(\alpha\right)+S\bullet\sin\left(\alpha\right)=R\bullet\sin\left(\alpha+\varphi\right)\)conversion, the parameters \(C\) and \(S\) can be replaced to \(R\) and\(\phi\) as
\(\sigma_{L1}\left([x_{i},x_{i+1}]\right)=R\bullet\left|sin(2\pi\omega x_{i}+\phi+\varphi)\right|\)(14),
where
\(R=\sqrt{2}\frac{A}{n}\sqrt{\left(1+\frac{n^{2}}{4}\right)-nsin(n)-\left(1-\frac{n^{2}}{4}\right)\cos\left(n\right)}\)(15)
and
\(\varphi=arctg\frac{1-\frac{n}{2}\sin\left(n\right)-cos(n)}{-\frac{n}{2}+\sin\left(n\right)-\frac{n}{2}cos(n)}\)(16).
Note that (15) and (16) depends purely on the ratio of the sampling interval and the period of the signal, \(N\), c.f. (11). In (15) it is also multiplied by \(A\), which provides the scale (and the unit) of\(R\), i.e. it works as the scale factor of the ordinate of the figure, while only the ratio \(N\) is relevant along the abscissa.
Similarly, the sampling error based on the L2-norm can also be derived applying the definition of RMS,
\(\sigma_{L2}\left([x_{i},x_{i+1}]\right)=\frac{L2\left([x_{i},x_{i+1}]\right)}{\sqrt{n}}=\sqrt{\frac{\sum_{x_{i}}^{x_{i+1}}{\varepsilon_{k}}^{2}}{n}}=\sqrt{\frac{\int_{x_{i}}^{x_{i+1}}{{\varepsilon(x)}^{2}\text{dx}}}{T}}\)(17).
Making use of (3) and (5), the definite integral in (17) becomes
\begin{equation} {L2\left(\left[x_{i},x_{i+1}\right]\right)}^{2}=\nonumber \\ \end{equation}
\(\int_{x_{i}}^{x_{i+1}}{\left(Asin(2\pi\omega\ x+\phi)-\frac{\left(x_{i+1}-x\right)Asin(2\pi\omega\ x_{i}+\phi)+\left(x-x_{i}\right)Asin(2\pi\omega\ x_{i+1}+\phi)}{T}\right)^{2}\text{dx}}\)(18),
following similar steps of derivation to Appendix A, it can be expressed in a compact form of
\({L2\left(\left[x_{i},x_{i+1}\right]\right)}^{2}=C\bullet\cos\left(4\pi\omega x_{i}+2\phi\right)+S\bullet\sin\left(4\pi\omega x_{i}+2\phi\right)+B\)(19),
where
\begin{equation} C=-\frac{A^{2}T}{24\pi^{2}\omega^{2}{T}^{2}}\left\{4\pi^{2}\omega^{2}{T}^{2}-6+\left(4\pi^{2}\omega^{2}{T}^{2}-6\right)\cos\left(4\pi\omega T\right)+\left(4\pi^{2}\omega^{2}{T}^{2}+12\right)\cos\left(2\pi\omega T\right)-9\pi\omega Tsin(4\pi\omega T)\right\}\nonumber \\ \end{equation}
(20),
\begin{equation} S=-\frac{A^{2}T}{24\pi^{2}\omega^{2}{T}^{2}}\left\{9\pi\omega T-\left(4\pi^{2}\omega^{2}{T}^{2}-6\right)\sin\left(4\pi\omega T\right)-\left(4\pi^{2}\omega^{2}{T}^{2}+12\right)\sin\left(2\pi\omega T\right)-9\pi\omega Tcos(4\pi\omega T)\right\}\nonumber \\ \end{equation}
(21),
and
\(B=-\frac{A^{2}T}{24\pi^{2}\omega^{2}{T}^{2}}\left\{12-20\pi^{2}\omega^{2}{T}^{2}-\left(4\pi^{2}\omega^{2}{T}^{2}+12\right)\cos\left(2\pi\omega T\right)\right\}\)(22).
By introducing the \(n\) defined by (11), it simplifies to
\begin{equation} C=-\frac{A^{2}T}{6n^{2}}\left\{n^{2}-6+\left(n^{2}-6\right)\cos\left(2n\right)+\left(n^{2}+12\right)\cos\left(n\right)-\frac{9}{2}nsin(2n)\right\}\nonumber \\ \end{equation}
(23),
\begin{equation} S=-\frac{A^{2}T}{6n^{2}}\left\{\frac{9}{2}n-\left(n^{2}-6\right)\sin\left(2n\right)-\left(n^{2}+12\right)\sin\left(n\right)-\frac{9}{2}ncos(2n)\right\}\nonumber \\ \end{equation}
(24),
and
\(B=-\frac{A^{2}T}{6n^{2}}\left\{12-{5n}^{2}-\left(n^{2}+12\right)\cos\left(n\right)\right\}\)(25).
Using the\(C\bullet\cos\left(\alpha\right)+S\bullet\sin\left(\alpha\right)=R\bullet\sin\left(\alpha+\varphi\right)\)conversion, the parameters \(C\) and \(S\) can be replaced to \(R\) and\(\varphi\) as
\({L2\left([x_{i},x_{i+1}]\right)}^{2}=R\bullet\sin\left(4\pi\omega x_{i}+2\phi+\varphi\right)+B\)(26),
where
\(R=\frac{A^{2}T}{6n^{2}}\left(\left(n^{2}+12-9n\sin\left(n\right)+\left(2n^{2}-12\right)\cos\left(n\right)\right)^{2}\operatorname{}\left(n\right)+\frac{1}{4}\left(-9n+9n\cos\left(2n\right)+\left(2n^{2}-12\right)\sin\left(2n\right)+\left(2n^{2}+24\right)\sin\left(n\right)\right)^{2}\right)^{\frac{1}{2}}\)
(27),
\(\varphi=arctg\frac{n^{2}-6+\left(n^{2}-6\right)\cos\left(2n\right)+\left(n^{2}+12\right)\cos\left(n\right)-\frac{9}{2}nsin(2n)}{\frac{9}{2}n-\left(n^{2}-6\right)\sin\left(2n\right)-\left(n^{2}+12\right)\sin\left(n\right)-\frac{9}{2}ncos(2n)}\)(28)
and \(B\) is as in (25). As (23) to (28) refers to\({L2\left(\left[x_{i},x_{i+1}\right]\right)}^{2}\), the sampling error can be determined by (17) as
\(\sigma_{L2}\left([x_{i},x_{i+1}]\right)=\frac{L2\left([x_{i},x_{i+1}]\right)}{\sqrt{T}}=\sqrt{\frac{{L2\left(\left[x_{i},x_{i+1}\right]\right)}^{2}}{T}}=\sqrt{\frac{R\bullet\sin\left(4\pi\omega x_{i}+2\phi+\varphi\right)+B}{T}}\)(29),
so no closed-form solution can be derived. Similarly to (15) and (16), (27) and (28) depends purely on the ratio of the sampling interval and the period of the signal, \(N\), and the amplitude, \(R\) provides the scale and the unit in (27) by the multiplicator of \(A^{2}T\).
Generalization of the formulation
A major shortcoming of the derived formulation is that it holds for purely periodic signal, which is indeed unrealistic. Note, however, that theoretically it can be generalized to any time series, as a Fourier series representation of a function consists of infinite number of periodic components, c.f. equation (1), where summation is done byc , and the reciprocal of any wavelengths,Tc , is the frequency,\(f_{c}=\frac{1}{T_{c}}\). Due to the orthonormality of the Fourier base functions, the effect if the sampling error can be estimated to each component independently along the Fourier spectrum. Considering the frequency of a Fourier component of the signal, \(f_{c}\) and that of the sampling, \(f_{s}\), the ratio N for each component can be determined similarly to equation (2):
\(N_{c}=\frac{\ f_{c}}{f_{s}}=\frac{T}{T_{c}}\) (30).
It can then be used for each Fourier components independently using the equations of section 2.
Note that the bias does not need special attention in this case. As for the c=0 term the Fourier component \(T_{0}=\infty\) and\(f_{0}=0\), for any non-zero sampling frequency, \(f_{s}\neq 0\), equation (30) becomes zero. For such a case, equations (11) to (16) and (23) to (29) has singularity, therefore the signal should be unbiased before estimating the sampling error.
Discussion
When sampling error of a periodic signal is to be estimated, it should definitely be kept in mind that it highly depends on which part of the signal it takes place, c.f. in Figure 1 the errors are apparently larger at the extremes (peaks) than around the inflection points.
Equations (8) to (10) and (19) to (22) provide analytic formulations for the periodicity of the sampling error. These equations indicate that it purely depends on the ratio of the signal period and the sampling interval, \(N\). The periodicity of the sampling error is displayed in Figure 3 for an arbitrary example of N=0.05 ratio, i.e. 20 samplings during a period. It shows that the periodicity of the error is tied to the periodicity of the signal, but with a phase lag (it is 9° in this example). It also shows that for such a case the maximal error is 0.82% and 0.90% of the amplitude of the period of the signal, respectively for the L1 and L2 norms.