# A Simple and Efficient Method for RSS-AOA-Based Localization with Heterogeneous Anchor Nodes
## 3 Proposed Two-Stage Localization Method
### The First Stage  
In the first stage, a rough estimation of the target location is calculated. First, the measured time series are averaged over time as \(\hat{\phi}_{i}=\frac{1}{T}\sum\limits_{t=1}^{T}\hat{\phi}_{it}\), \(\hat{\alpha}_{i}=\frac{1}{T}\sum\limits_{t=1}^{T}\alpha_{it}\), \(\hat{P}_{i}=\frac{1}{T}\sum\limits_{t=1}^{T}p_{it}\). Using spherical coordinates, we can express the distance between the target node and the \(i\)-th anchor node, \(\|\mathbf{x}-\mathbf{a}_{i}\|\), as \(\hat{\mathbf{u}}_{i}^{\mathrm{T}}(\mathbf{x}-\mathbf{a}_{i})\), where \(\hat{\mathbf{u}}_{i}\) is a unit vector in the direction of the target node from the \(i\)-th anchor node, which is given by  
\[\hat{\mathbf{u}}_{i}=[\cos\hat{\phi}_{i}\sin\hat{\alpha}_{i},\sin\hat{\phi}_{i} \sin\hat{\alpha}_{i}]^{T}. \tag{13}\]  
To simplify the process, the unit vector \(\hat{\mathbf{u}}_{i}\) was defined based on the average values of the sequential measurements that incorporate actual measurement noise as  
\[\hat{\mathbf{u}}_{i}=[\cos\hat{\phi}_{i}\sin\hat{\alpha}_{i},\sin\hat{\phi}_{i} \sin\hat{\alpha}_{i},\cos\hat{\alpha}_{i}]^{T}. \tag{14}\]  
Figure 3: The CRLBs for the simple localization scenario. (**a**) CRLB for only AOA time series. (**b**) CRLB for only RSS time series. (**c**) CRLB for RSS-AOA time series.  
Subsequently, the time-averaged RSS-AOA values can be expressed as follows:  
\[\mathbf{c}_{i}^{\mathrm{T}}(\mathbf{x}-\mathbf{a}_{i})\approx 0, \tag{15}\]  
\[(\cos\hat{\mathbf{x}}_{i}\hat{\mathbf{u}}_{i}-\mathbf{k})^{\mathrm{T}}(\mathbf{x}-\mathbf{a}_{i}) \approx 0, \tag{16}\]  
\[\lambda_{i}\hat{\mathbf{u}}_{i}^{\mathrm{T}}(\mathbf{x}-\mathbf{a}_{i})\approx\beta, \tag{17}\]  
where \(\mathbf{c}_{i}=[-\sin\hat{\phi}_{i},\cos\hat{\phi}_{i},0]^{\mathrm{T}}\), \(\mathbf{k}=[0,0,1]^{\mathrm{T}}\), \(\lambda_{i}=10^{\frac{\hat{\mathbf{b}}_{i}}{10^{\mathrm{T}}}}\), \(\beta=d_{0}10^{\frac{\hat{\mathbf{b}}_{i}}{10^{\mathrm{T}}}}\). In particular, we refer to each equation in (15)-(17) as LWLS equations. Then, the target location can be obtained by applying the LWLS estimation to these \(3N\) LWLS equations as follows:  
\[\hat{\mathbf{x}}_{\mathrm{WLS}}=\arg\min_{\mathbf{x}}\sum_{i=1}^{N}w_{i}^ {2}\Big{(}\mathbf{c}_{i}^{\mathrm{T}}(\mathbf{x}-\mathbf{a}_{i})\Big{)}^{2} +\sum_{i=1}^{N}w_{N+i}^{2}\Big{(}(\cos\hat{\mathbf{x}}_{i}\hat{\mathbf{u} }_{i}-\mathbf{k})^{\mathrm{T}}(\mathbf{x}-\mathbf{a}_{i})\Big{)}^{2} \tag{18}\] \[+\sum_{i=1}^{N}w_{2N+i}^{2}\Big{(}\lambda_{i}\hat{\mathbf{u}}_{i}^{ \mathrm{T}}(\mathbf{x}-\mathbf{a}_{i})-\beta\Big{)}^{2},\]  
where \(\mathbf{w}\) is a \(3N\times 1\) vector which denotes the weights of the LWLS equations. The weights in the first stage are range-based, which can be expressed as \(w_{i}=w_{N+i}=w_{2N+i}=1-\frac{\hat{d}_{i}}{\sum\limits_{i=1}^{N}\hat{d}_{i}}\), \(\hat{d}_{i}=d_{0}10^{\frac{\hat{\mathbf{b}}_{i}-\hat{\mathbf{b}}_{i}}{10\gamma}}\), \(i=1,2,\cdots,N\).  
For ease of solving, (18) can be expressed as the following matrix form:  
\[\hat{\mathbf{x}}_{\mathrm{WLS}}=\arg\min_{\mathbf{x}}\lVert\mathbf{W}(\mathbf{A}\mathbf{ x}-\mathbf{b})\rVert^{2}, \tag{19}\]  
where \(\mathbf{W}=\text{diag}(w_{1},w_{2},\cdots,w_{3N})\) is the weight matrix, \(w_{i}\) is referred as to the weight of the \(i\)-th LWLS equation, and \(\mathbf{A}=\begin{bmatrix}\vdots\\ \mathbf{c}_{i}^{\mathrm{T}}\\ \vdots\\ (\cos\hat{\mathbf{x}}_{i}\hat{\mathbf{u}}_{i}-\mathbf{k})^{\mathrm{T}}\\ \vdots\\ \lambda_{i}\hat{\mathbf{u}}_{i}^{\mathrm{T}}\\ \vdots\\ \end{bmatrix}\) is a \(3N\times 3\) matrix, \(\mathbf{b}=\begin{bmatrix}\vdots\\ \mathbf{c}_{i}^{\mathrm{T}}\mathbf{a}_{i}\\ \vdots\\ (\cos\hat{\mathbf{x}}_{i}\hat{\mathbf{u}}_{i}-\mathbf{k})^{\mathrm{T}}\\ \vdots\\ \end{bmatrix}\) is a \(3N\times 1\) vector.  
Then, the closed-form solution of (19) can be obtained as follows:  
\[\hat{\mathbf{x}}_{\mathrm{WLS}}=\Big{(}\mathbf{A}^{\mathrm{T}}\mathbf{W}^{\mathrm{ T}}\mathbf{W}\mathbf{A}\Big{)}^{-1}\mathbf{A}^{\mathrm{T}}\mathbf{W}^{\mathrm{T}} \mathbf{W}\mathbf{b}. \tag{20}\]