## May 25th 2015, Least Squares Fitting

← May 25th 2015 Track Denoising | ● | May 25th 2015 Weighted Least Squares →

The main assumption for least squares fitting of the GPS signal is that the device will maintain a constant acceleration during a short period of time.

This means that the path described in that time frame is parabolic leading to a quadratic function term.

In order to illustrate the least squares fitting approach, we first restrict ourselves to polynomial functions. Then we have a quadratic function $f(t)$:

The dependent variable is the positional coordinate and the independent variable is the time $t$.

Given a series of measurements $m_i, i=1..n$ at times $t_i$ we use the method of least squares to fit the above curve to the measured points so that the error becomes smallest. The error is called the residual.

Using squared error terms for the residual (hence the name least squares), we get the following formula for the residual R:

Minimizing the error corresponds to finding coefficients $c_0$, $c_1$ and $c_2$, where the residual gets minimal. We find the minimum but setting the gradient to zero: $\nabla R=0$.

Calculating the gradient and the corresponding partial derivatives leads to the following system of linear equations:

The solution of the system is found by multiplying both sides with the inverse of the left-hand side matrix.

The left-hand side is a 3×3 matrix, which can be inverted easily at fixed computation cost. So the run time is in the order of n.

← May 25th 2015 Track Denoising | ● | May 25th 2015 Weighted Least Squares →