## 3 Reducing the Uncertainty at the Output of Kalman Filter by Post Processing
### Reducing the Uncertainty at the Output of Kalman Filter
#### 3.3.1 Polynomial Fitting  
The meaning of data fitting is the finding of a mathematical description for data [22]. This mathematical description should be as precise as possible. A measure for the deviation of the model with data, commonly used in practice, is the root mean squared error (RMSE). So, fit means to find a minimum of the RMSE. To achieve this, a fit function f, which generally contains adjustable parameters, the fit parameters: \(a_{i},\ i=0\ldots n\), must be defined. Let us consider the simple case of a set of data \(y_{t},\ t=1,\ldots,M\) that are collected as a function of one independent variable x at the points \(x_{t}\). We would like the fit function f to describe these data in an approximate way as:  
\[y_{t}\approx f(a_{0},\ldots,a_{n},x_{t}) \tag{9}\]  
To find the parameters \(a_{i}\) for the best approximation, the sum over the squared residuals must be minimized:  
\[r=\sum_{t}(y_{t}-f(a_{0},\ldots,a_{n},x_{t}))^{2} \tag{10}\]  
Forcing the derivatives of r concerning all \(a_{i}\) to be zero, we can find the minimum of RMSE:  
Therefore, data fitting is a convex optimization problem. Polynomial fitting supposes to use the simplest type of fit functions: polynomials,  
\[\frac{\partial r}{\partial a_{0}}=0,\ \frac{\partial r}{\partial a_{1}}=0,\ \ldots,\frac{\partial r}{\partial a_{n}}=0. \tag{11}\]  
\[f(a_{0},\ldots,a_{n},x_{t})=a_{0}+a_{1}x_{t}+\ldots+a_{n}x_{t}^{n} \tag{12}\]  
In the case of the polynomial fitting, Equation (11) becomes a system of \(n+1\) linear equations for the \(n+1\) unknowns \(a_{j}\). The system may be solved by standard methods for linear equations. Generally, no approximate optimization procedures are necessary because the system of equations has one unique solution. The disadvantage of this data fitting method is the necessity to a priori know the degree of the polynomial \(f(a_{0},\ldots,a_{n},x_{t})\), \(n\).  
In the case of data at the output of Kalman filter, we have two sequences of coordinates: \(\{x_{t}\}\) and \(\{y_{t}\}\) (as it can be observed in Equations (1) or (3)), which represent samples of the horizontal and vertical axes of the reference system where the trajectory of target's movement is represented. To realize the polynomial fitting of those data, we can proceed in two steps: first, we apply the fitting procedure to the data \(\{x_{t}\}\) and, next, we apply the fitting procedure to the data \(\{y_{t}\}\), because by composing two polynomial functions, another polynomial function is obtained. This method will be named in the following implicit polynomial fitting. The result is polynomial, but the chronology is not necessarily kept. Another disadvantage is the possible loss of the extrema of one or both data sequences \(\{x_{t}\}\) and/or \(\{y_{t}\}\) as a consequence of the smoothing effect of the implicit polynomial fitting method. This disadvantage can be counteracted by applying explicit polynomial fitting. This polynomial fitting method has the following steps:  
* Polynomial fitting of the sequence \(\{x_{t}\}\): \(x=P(t)\);
* Inverting the result obtained: \(t=P^{-1}(x)\);
* Polynomial fitting of the sequence \(\{y_{t}\}\): \(y=Q(t)\);
* Substitution of the result of the second step into the result of the third step: \(y=Q\big{(}P^{-1}(x)\big{)}\).  
Some precautions must be taken for the application of the explicit polynomial fitting method regarding the monotony of functions \(P\) and \(Q\) to obtain a correct result because the polynomials are invertible functions only on intervals. Another disadvantage of the polynomial fitting method is the high computation complexity required in the case of great polynomial degrees. When n has a big value, the procedure of solving the system in Equation (11) implies a high computation complexity. The procedure of solving the system of Equation (11) can be avoided by directly extracting the polynomial parts of the sequences \(\{x_{t}\}\) and \(\{y_{t}\}\). The direct extraction of the polynomial part of a signal can be performed in the wavelets' domain.