# Vehicle Trajectory Reconstruction Using Lagrange-Interpolation-Based Framework
## 3 Methodology
### Lagrange Interpolation  
Re-estimating the corresponding position data after eliminating the outliers is necessary. Using existing deep learning methods, it is difficult to reconstruct data adaptively and reflect the relationship between independent variables and dependent variables accurately, because the adaptive model is trained based on abnormal trajectory data. This paper finds an approximate function \(p(x_{i})\) in a given interval to obtain the expected results. It is defined by Equation (4).  
\[p(x_{i})=f(x_{i})i=0,1,2,\cdots,n \tag{4}\]  
where \(x_{i}\) is the value of \(i\)th points in the interval \([0,n]\), and \(f(x_{i})\) is the truth function.  
It is noted that the expected values are different when different interpolation functions are selected, according to different bases and constraints in linear space. Lagrange interpolation is a special polynomial interpolation method for solving a class of polynomial problems with given point values. It can choose appropriate estimation scales based on the different characteristics of the data, compared with the mean interpolation method [39].  
Figure 2: The method framework for vehicle trajectory reconstruction.  
Equation (5) shows how the method is used to re-estimate the removed outliers of speeds and accelerations at any time.  
\[Ln(x)=\sum_{j=0}^{n}y_{j}j_{j}(x)=\sum_{j=0}^{n}y_{j}\prod_{\begin{array}{c}i=0 \\ i\
eq j\end{array}}^{n}\frac{x-x_{i}}{x_{j}-x_{i}} \tag{5}\]  
where \(l_{j}(x)\) is the Lagrange interpolation basis function of degree \(n\).  
After outliers are identified and eliminated, the method re-estimates the value of any position within a given interval based on \(n+1\) different interpolation points. The paper uses a number of data to construct an approximate function and obtain optimal parameters with the least given adjacent data, and the data called a data chain (Figure 3) contain outliers and twenty neighbor data.  
The paper uses the adjacent data in data chains to construct a Lagrange interpolation polynomial and performs a lot of experiments to re-estimate outliers. It finds that the re-estimated speed values obtained from the fifth-degree Lagrange interpolation polynomial are the closest to the empirical vehicle trajectory data, and the convergence calculation of the method takes less time. It is noted that there must be at least three data points on both sides of a data chain when establishing the polynomial. If there are less than thirteen data points between two outliers, the method should merge two neighbor chains into one chain. When there are less than three data points outside the chain, this paper discusses two cases: (1) When there is at least one data point at the boundary of the chain, the neighbor data can be obtained from the other side of the chain to supplement data. (2) When there are no data points at the boundary of the chain, the chain should be deleted. Compared with the abnormal speed, the acceleration has less impact on the neighbor data, the paper finds that the cubic Lagrange interpolation polynomial is more suitable for re-estimating acceleration.