# A Carrier Estimation Method Based on MLE and KF for Weak GNSS Signals
## 3 MLE Discriminator
### Parameters Estimation by LM Algorithm  
Searching the extreme value of the cost function in (9) is a two-dimensional optimization problem. A simple method, known as the grid search method, is to search the two-dimensional space step by step. This method is easy to implement and the search scope can be adjusted arbitrarily. However, its precision is limited by the resolution. Improving the resolution will increase the computation burden significantly. Another method is the gradient-based method which searches the extreme point along the gradient direction. The Levenberg-Marquardt algorithm, also known as the damped least-squares (DLS) method, is one of the most effective optimization methods to solve non-linear least squares problems [14]. It can be seen as an improved Gauss-Newton (GN) algorithm and converges to the optimal value iteratively. It has high efficiency and is not limited by the resolution. Its core formula to search the maximum can be expressed as:  
\[\hat{\theta}_{i+1}=\hat{\theta}_{i}+(H_{i}+d)^{-1}G_{i},\quad i=0,1,2... \tag{10}\]  
where \(i\) represents the iteration index, and \(\hat{\theta}\) is the 2-by-1 MLE state vector (\(f\) and \(\varphi\)). \(d\) is a 2-by-2 diagonal matrix which has two functions, ensuring that \(H_{i}+d\) is a positive definite matrix and adjusting the convergence rate. \(G_{i}\) and \(H_{i}\) are the 2-by-1 gradient vector and the 2-by-2 pseudo-Hessian matrix respectively, defined as follows:  
\[G_{i}=\left[\frac{\partial L}{\partial\theta}\right]_{\theta=\hat{\theta}_{i}} \tag{11}\]  
\[H_{i}=\left[\frac{\partial^{2}L}{\partial\theta^{2}}\right]_{\theta=\hat{ \theta}_{i}} \tag{12}\]  
where,  
\[\frac{\partial L}{\partial\theta}=\left[ \begin{array}{cc}\frac{\partial L}{ \partial f}&\frac{\partial L}{\partial\varphi}\end{array} \right]^{T}\text{ and }\frac{\partial^{2}L}{\partial\theta^{2}}=\left[ \begin{array}{cc}\frac{\partial^{2}L}{\partial f^{2}}&\frac{\partial^{2}L }{\partial f\partial\varphi}\\ \frac{\partial^{2}L}{\partial\varphi\partial f}&\frac{\partial^{2}L}{ \partial\varphi^{2}}\end{array} \right] \tag{13}\]  
Figure 2: Normalized maximum likelihood estimation (MLE) cost function as a function of the frequency and phase errors. Detailed expressions of the terms in (13) are provided as follows:  
\[\left\{ \begin{array}{l}\frac{\partial L}{\partial f}=2\pi T\sum\limits_{n=0}^{N-1 }n(-R(r_{n})\cdot\sin(\alpha)+I(r_{n})\cdot\cos(\alpha))\\ \frac{\partial L}{\partial\varphi}=\sum\limits_{n=0}^{N-1}(-R(r_{n})\cdot \sin(\alpha)+I(r_{n})\cdot\cos(\alpha))\\ \frac{\partial L}{\partial f^{2}}=-4\pi^{2}T^{2}\sum\limits_{n=0}^{N-1}n^{2}( R(r_{n})\cdot\cos(\alpha)+I(r_{n})\cdot\sin(\alpha))\\ \frac{\partial L}{\partial\varphi^{2}}=-\sum\limits_{n=0}^{N-1}(R(r_{n})\cdot \cos(\alpha)+I(r_{n})\cdot\sin(\alpha))\\ \frac{\partial L}{\partial f\partial\varphi}=\frac{\partial L}{\partial \varphi\partial f}=-2\pi T\sum\limits_{n=0}^{N-1}n(R(r_{n})\cdot\cos(\alpha)+I( r_{n})\cdot\sin(\alpha))\end{array} \right. \tag{14}\]  
The detailed realization of the LM algorithm is shown in Figure 3. First, the initial values for \(\hat{\theta}_{0}\) and \(d\) are specified in Step 1. In the tracking process, the phase and frequency are assumed to track accurately. Therefore, \(\hat{\theta}_{0}=[0\,0]^{T}\). \(d\) is initialized as an experience value. Step 2 calculates gradient matrix \(G\) and Hessian matrix \(H\) by (11) and (12). Step 3 ensures that \(H\)+\(d\) is positive definite. If \(H\)+\(d\) is negative definite, \(d\) must be increased. This step is the main difference between the LM algorithm and GN algorithm. It ensures the inverse matrix of \(H\)+\(d\) is always present and the iteration process can continue. Step 4 updates the parameters matrix by (10). Based on this, the cost function values at \(\hat{\theta}_{i}\) and \(\hat{\theta}_{i+1}\) are calculated and compared in Step 5. In order to ensure efficient iteration, \(L\big{(}\hat{\theta}_{i+1}\big{)}\) must be larger than \(L\big{(}\hat{\theta}_{i}\big{)}\) (searching the maximum value).