Available online at www.sciencedirect.com
ScienceDirect Procedia Computer Science 103 (2017) 266 – 272
XIIth International Symposium «Intelligent Systems», INTELS’16, 5-7 October 2016, Moscow, Russia
Interpolation of data stream by polynomials of ultrahigh degree V.F. Zhirkov1,2,*, K.N. Bolshakov1, G.V. Prokofiev1 1
Zelenograd nanotechnology center, Russian Federation, 124527, Moscow, Zelenograd, Solnechnaya Alleya, d.6 2 Vladimir state University, Russian Federation,600000, Vladimir, Gorky str., 85
Abstract Considered interpolation of data stream at high requirements for precision interpolation (-100 dB and above). Presents results of studies of the signals properties of recovered by interpolation using polynomials ultrahigh degrees (up to 60). Offered the technique of applying a polynomial interpolation, which allows obtain the required accuracy of the reconstructed signal at a relatively low computational complexity. Developed a numerical implementation of the polynomial interpolator, which allows obtain a near-linear dependence of the computational complexity from polynomial degree. Obtained a significantly higher interpolation accuracy with less computational complexity by comparing LF-filtering. © 2017 2017The TheAuthors. Authors. Published Elsevier © Published by by Elsevier B.V.B.V. This is an open access article under the CC BY-NC-ND license (http://creativecommons.org/licenses/by-nc-nd/4.0/). Peer-review under responsibility of the scientific committee of the XIIth International Symposium «Intelligent Systems». Peer-review under responsibility of the scientific committee of the XIIth International Symposium “Intelligent Systems” Keywords: data flow, high precision interpolation, polynomials of high degrees.
1. Introduction Interpolation (often paired with decimation) is a basic set of DSP operations. The accuracy requirements of data representation and processing are growing. For example, when creating a modern precision position sensors 1 the error of interpolation shall not exceed -100 dB (10-5). Obviously, this is not the limit. Currently such precision interpolation is performing using low pass filter (LF), which is an expensive operation. The aim of this work is the search for more effective solutions. The article describes an alternative approach, based on a mathematical interpolation of decimated data stream by polynomials. Mathematical interpolation exhaustively considered in the extensive literature on numerical methods,
* Corresponding author. E-mail address:
[email protected]
1877-0509 © 2017 The Authors. Published by Elsevier B.V. This is an open access article under the CC BY-NC-ND license (http://creativecommons.org/licenses/by-nc-nd/4.0/). Peer-review under responsibility of the scientific committee of the XIIth International Symposium “Intelligent Systems” doi:10.1016/j.procs.2017.01.104
267
V.F. Zhirkov et al. / Procedia Computer Science 103 (2017) 266 – 272
for example2,3. By tradition, the interpolation of curves and surfaces by cubic splines (n = 3) is often treated as an interpolation polynomials of high degrees. Our studies have shown that the use of cubic splines for the described1 problem of does not allow the error is less than -37 dB (> 10-2) when the requirements of -100dB (10-5) and above. The difference is huge. Objective - to achieve a predetermined and higher accuracy at an effective numerical implementation. In the "interpolation polynomial in the Lagrange form"3, after analysis of the approximation errors come to a conclusion "about the practical inapplicability of interpolation polynomials of high degree". Fortunately, this is not always the case. In this paper, a solution is basing on the use of polynomials of higher degrees (up to 52). In the article the technique of applying the Lagrange interpolation polynomials of high degrees in the processing of streaming data, which provides a very high interpolation accuracy (up to 10-9). With increasing degree polynomial computational complexity increases, so a positive result can be obtained only if the effective numerical implementation, which is also proposed in this paper. Comparative studies obtained simulation showed high efficiency of this approach as compared to low-pass filtration, a substantial increase in accuracy and, simultaneously, reducing the requirements for calculating resources. The result is also a method of system research and the interpolator output characteristics for different sets of input data. All results confirmed by simulation. 2. Problem formulation f (x) – a test function with the required properties in applications. ^ f ( x j )` , j 1, 2, } infinite, uniform flow of data obtained by sampling the function f x , dx x j 1 x j . From it are taken the readings with the decimation factor m. New sequence is ^f i f x i ` , intervals h xi 1 xi dx m , further used as input data interpolator. The field of view is input interpolator window X > x1 , хn 1 @ , which consists of n segments ª¬ xi , xi 1 º¼ and n 1 nodes. By digitally processing interpolation creates in each segment of m-1 new points xij, inserting into the output data stream m 1 the calculated values of y xij . The window is shifting forward by one unit in each step. m - interpolation factor. It is necessary to construct the interpolation function y x , passing through all of the nodes x i , y i and allows you to calculate y for any x in the interval X . In this case f (x) and y(x) coincide only at nodes. At the remaining points are possible error e x f x y x . Interpolation quality evaluation is based on a function e(x) for the entire interval, its segments and each point in the sequence. 3. Interpolation polynomial The approximating function is given by a polynomial P n, x
pn x n pn 1 x n 1 } p1 x1 p0
(1)
coefficients is to be determined. It is required that the polynomial in x i nodes took appropriate values y i . There is a unique polynomial of degree n, satisfying these conditions. It is called a interpolation polynomial. Its coefficients are obtained by solving a system of linear equations: pn x1n pn 1 x1n 1 } p1 x11 p0
y1
pn x2n pn 1 x2n 1 } p1 x12 p0
y2
(2)
... pn xnn1 pn 1 xnn11 } p1 x1n 1 p0
yn 1
268
V.F. Zhirkov et al. / Procedia Computer Science 103 (2017) 266 – 272
Fig. 1. The interpolation polynomials of Lagrange.
The matrix of this system is a Vandermonde matrix. The system has a unique solution. The numerical solution may be obtained, for example, by multiplication on the inverse matrix: P vander X \ Y. However, this method of solution is difficult to implement a real-time system. Consider the analytic solution. Interpolation polynomial in the Lagrange form expresses the dependence of x explicitly and admits integer implementation, whereby it is selected for subsequent studies. f x # yx
P n, x
n
¦y k L n, k, x ,
(3)
k 0
L n, k, x
n
( x x j / x k x j ),
(4)
j 0 jz k
In this interpolation error e n, x
f x P n, x does not exceed
n § n 1 · e n, x d abs ¨ f x x x j ¸ j 0 © ¹
n 1 !
(5)
The values of the intermediate points in the interpolation interval can be calculated in two ways: by the formula (1) after the solution of (2), or directly by the formula (3). Equation (5) suggests that under certain conditions a choice n can achieve the desired recovery errors. 4. Interpolation error study Simulation using Matlab built-in functions performed to study the properties of the error function. The coefficients of the polynomial approximating P [p 0 , } , p n ] can be found by referring to the function P=poiyfit (X, Y, n). To calculate the values of the polynomial y(x) in the interval used polyval (Р, x) function, where x covers the vector table values interval X and may even slightly exceed its limits. A·sin Z t as a test signal. The sampling frequency was selected close to the Nyquist Was used sinusoid f x frequency (2 times higher), that, along with the required accuracy (10-5 or higher) greatly complicates the task.
V.F. Zhirkov et al. / Procedia Computer Science 103 (2017) 266 – 272
Fig. 2. Average values of the errors in the segments window interpolation.
We investigate the dependence of interpolation errors on the degree of the polynomial and the x in segment X . Error e x f x y x - function defined on the interpolation interval is the difference between the original and the reconstructed y x P n, x , signals. Next, we consider the reduced error er x e x / A , independent of the signal amplitude. Fig. 1. shows plots of the interpolation results for n 5 . Interpolation error is represented by a dotted line. It strengthened 3 times for easy observation. It is seen that the interpolation error increases when approaching the limits of the interval, depending on their location on the curve. The maximum error on the entire interval increases with increasing n. The maximum error in the individual segments is the smallest in the center of the interval and grows in the direction of the boundary segments. By increasing the number of nodes the accuracy increases in the central segments and at the same time worsening the border. Errors on a particular segment connected not only with his position (number) in the interpolation segment, but also with the placement of this segment in the studied function (phase). In the formula (5) is a factor of n 1 f x .To eliminate the influence of the latter and to establish the general laws, it is necessary to average the errors in each segment for all variants of accommodation of the segment on the interpolation function test that can be perform by scan. The quality of the interpolation the most accurate expressed er x function and derivative characteristics: er _ max max abs er x and er _ mean mean(abs er x ) , maximum and average errors are calculated for all segments in window. Average values for the errors in segments ( n 11 ) are shown in the graph of Fig. 2. The minimum value of 0.0011 , as expected, was obtained for the middle segment. For odd n the middle segment is uniquely determined. Only one segment of each of the successive windows to be used to obtain a minimum interpolation error. The error includes the error calculation, which increases with the degree of the polynomial. It is not noticeable when the n small, but, in principle, limits the maximum number of units and the order of the polynomial for large n. Although the polynomial interpolation method is not limited in terms of accuracy, for large values of n are beginning to affect the calculation error, resulting in an error, reached the minimum value, it begins to grow, Fig. 3. When the selected signal characteristics for n 52 the minimum value of 0.5e 09 average and 0.85e 09 maximum errors. 5. The interpolation algorithm Based on the conducted research the most efficient is the following method and implements its algorithm interpolating polynomials, based on using only the median segment in each interpolation window:
269
270
V.F. Zhirkov et al. / Procedia Computer Science 103 (2017) 266 – 272
Fig. 3. Interpolation errors
er _ mean (n).
Set the parameters of the actual signal. Based on the requirements of precision interpolation to determine the minimum size of the n interpolation window, corresponding to the maximum permissible error, for example, by using Fig. 3. 1. Set starting window, segment nodes x1(1:n), y1(1:n). 2. Find the coefficients of the approximating polynomial P of degree n by solution of equations (2). 3. Calculate of y x by the formula (1) for the m 1 interior points of the segment. Transfer the result to the output stream, attaching it to the previous one. 4. Move the window by unit (segment) forward. 5. Repeat 3-5, until the end of the test sequence reached. The algorithm is implemented in a modeling program, with which obtained quantitative estimates presented below. Fig. 4 shows the results of applying this algorithm to the test sequence when n 11 . Group delay ns is 11 . Interpolation begins from sixth «¬ 0.5n »¼ segments of the input sequence. Sixth segment is median for n segment. Interpolated data presented in dashed line.
271
V.F. Zhirkov et al. / Procedia Computer Science 103 (2017) 266 – 272 Fig. 4. Interpolation on the proposed algorithm.
They are drawn on the chart after the input signal, therefore, by the coincidence of the data is visible only red. At high magnification can be seen is not a complete coincidence of the two lines. Curve error amplified 30 times, presented in black. Comparison with the low-pass filtering shows that the proposed technique can provide significantly better quality interpolation. 6. Numerical implementation of the interpolator We consider the realization of the Lagrange formula (3) in integers in the median segment of the window in accordance with the proposed method of its application. Usually, m 2 p , for example, m 27 128 . Typically, p is from 5 to 10 ( m is from 32 to 1024). The median segment will contain m points with a distance 1 between them. The input section comprises of n 1 ª¬ x 0 ,..., x n º¼ nodes, x k k·m . The average segment number is s = (n +1)/2. Interpolation creates on the segment number sm points with coordinates x s v, v 1...m . After substituting in L n, k , x and replacing t v / m the formula is greatly simplified and contain only integers. The resulting L n, k , t is substituted into P n, t . Then performs the simplifying and grouping of terms in powers of t . The result are formulas for calculating the vector P . To perform the conversion manually is difficult, and for large n is impossible. Transformations were carried out using the mathematical software package for symbolic computation. This allows you to avoid mistakes. To demonstrate the obtained formulas for n 3 . The coefficients of the interpolation polynomial P n, t
p3 t 3 p 2 t 2 p1t p0
p3
y1 3 y2
3 y3 y 4 / 6
p2
( 2 y 2 y3 ) / 2
p1
( 2 3 y 2 6 y3 y 4 ) / 6
p0
y2 / 1
The equations can be written compactly: § § 0 1 0 0· ¨ ¨ ¸ M3 = ¨ 2 3 6 1 ¸ , Y= ¨ 1 2 1 0 ¨ 1 3 3 ¨ 1 ¸¹ © ©
M
M 3 Y, ( p i
y1 · § y2 ¸ ¨ , v 3= ¨ y3 ¸ ¨ y 4 ¸¹ ©
M i,: v 3 i ), i
0:3
1· 6¸ , 2¸ ¸ 6¹
(6)
Formula (6) looks like this for any n . Constants matrix M n and column multiplier vn , related only to the degree of the polynomial. They calculated once for specific n . Since m is an integer power of 2, for example, 27, multiplication by an integer power of 2 means the transfer point, so the calculation complexity is not affected. Matrix M, then the coefficients p i are calculated once per segment. The complexity of the calculations in this step should be divided into m, to take it to one of the interpolated point. Computation of P n, t (( p3t p2 )t p1 )t p0 performed by the Horner scheme, n multiplications and n additions per point. The complexity of the calculations for one calculation point can be estimated as Q | n 1 n / m multiplications of integers. For example, for m 27 , n 11, 29, 51 Q | 12, 36, 70 . The dependence of the computational complexity of n is close to linear.
272
V.F. Zhirkov et al. / Procedia Computer Science 103 (2017) 266 – 272
7. Conclusion The article presents the interpolation method of the data stream by polynomials of high degrees, which allows achieving a very high accuracy of signal reconstruction (up to 10-9). Such precision is not available when using traditional low-pass filtering. Suggested an efficient numerical implementation of this method, in which the dependence of the volume of computation from the degree of the polynomial is rather close to linear. The simulation results show that under the same requirements to the interpolator characteristics, the use of the proposed solutions allows to obtain a substantially smaller (at times) the computation volume and a substantial (by orders) increase of the accuracy. 8. Acknowledgments The work was supported by the Russian Ministry of Education in the framework of RFMEFI57914X0059 applied research, project number 14.579.21.0059. References 1. Prokofiev GV, Stahin VG, Obednin AA. Modern domestic specialized chips for position sensors. Proceedings of SFU. Engineering 2015;3: 200-11. 2. Verzhbitsky VM. Fundamentals of numerical methods: textbook for universities. Moscow: Vysshaya Shkola; 2002. 3. Mathematics. Interpolation and approximation of data (http://matlab.exponenta.ru/spline/index.php)