# Autonomous Underwater Vehicle Localization Using Sound Measurements of Passing Ships
## 4 MATLAB Simulations  
We use MATLAB (MathWorks, Natick, MA, USA) simulations to demonstrate the performance of the proposed localization approach. The scenario runs for 3000 s. The sampling duration is \(dt=1\) second.  
In Equation (29), the bearing measurement noise is set as \(\sigma_{b}=0.5\) degrees. This bearing noise model is commonly used in the literature on target tracking based on bearing measurements [32; 33; 34; 35].  
This paper considers the AUV that can locate itself by integrating a propeller and IMU. We set the noise in the simulations as follows. Let \(\sigma_{a}\) represent the standard deviation of \(a\). In Equation (27), we utilize \(\sigma_{a_{x}}=\sigma_{a_{y}}=2\)\((m/s^{2})\). This process noise is set considering the error in estimating \([z_{k}^{\sigma},y_{k}^{\sigma}]^{T}\), as the AUV integrates propeller and IMU for its localization [26; 27].  
Using the IMU-only localization, the AUV has been moving in underwater environments before time step 0. Suppose that at time step 0, the IMU-only localization estimates the range between the 1-st ship and the AUV as \(\Delta=1500\) m. Also, suppose that the range estimation error at time step 0 is bounded above by \(\delta=1000\) m. Using Equations (11) and (12), we set \(r_{min}=500\) m, and \(r_{max}=2500\) m. Also, \(M=5\) EKF tracks are used in total.  
The \(j\)-th EKF track (\(j\in\{1,\ldots,M\}\)) has its initial state vector \(\hat{\mathbf{X}}_{0|0}^{j}\) as  
\[\hat{\mathbf{X}}_{0|0}^{j}=\left(\begin{array}{c}R^{j}*c(b_{0}^{n_{0}^{0}})\\ R^{j}*s(b_{0}^{n_{0}^{0}})\\ \mathbf{0}_{2,1}\end{array}\right). \tag{41}\]  
Here, \(R^{j}=\frac{rn(j)+rn(j+1)}{2}\). Recall that \(rn(j)\) is defined in Equation (15). In Equation (41), \(\mathbf{0}_{2,1}\) indicates a zero vector with two columns. Recall that \(b_{0}^{n_{0}^{0}}\) in Equation (41) is the bearing measurement associated to the 1-st ship at sample-index 0.  
Using Taylor expansion on \(\hat{\mathbf{X}}_{0|0}^{j}(1:2)\) in Equation (41), we obtain  
\[Cov[\hat{\mathbf{X}}_{0|0}^{j}(1:2)]=\mathbf{M}*Cov[\mathbf{c}_{m}]*\mathbf{M }^{T}, \tag{42}\]  
where \(\mathbf{c}_{m}=[R^{j},b_{0}^{n_{0}^{0}}]^{T}\), and  
\[\mathbf{M}=\left(\begin{array}{cc}c(b_{0}^{n_{0}^{0}})&-R^{j}s(b_{0}^{n_{1} ^{0}})\\ s(b_{0}^{n_{1}^{0}})&R^{j}c(b_{0}^{n_{1}^{0}})\end{array}\right). \tag{43}\]  
Furthermore, we have  
\[Cov[\mathbf{c}_{m}]=\mathbf{diag}((\frac{rn(j+1)-rn(j)}{2})^{2},\sigma_{b}^{2}). \tag{44}\]  
Considering the \(j\)-th EKF track, \(\mathbf{p}_{0|0}^{j}\) is selected as  
\[\mathbf{p}_{0|0}^{j}=\left(\begin{array}{cc}Cov[\hat{\mathbf{X}}_{0|0}^{j}( 1:2)]&\mathbf{0}_{2}\\ \mathbf{0}_{2}&\mathbf{I}_{2}*V_{max}^{2}/3\end{array}\right). \tag{45}\]  
Here, \(V_{max}\) is the maximum speed of an AUV, which is assumed to be known a priori. We utilize \(V_{max}=5\) m per second. In Equation (45), \(\mathbf{0}_{2}\) indicates a 2 by 2 zero matrix.  
We run \(M_{c}=20\) Monte-Carlo simulations. \(\mathbf{E}_{k}^{m}\) where \(m\in\{1,2,\ldots,M_{c}\}\) is the AUV position estimation at sample-index \(k\) utilizing the \(m\)-th Monte-Carlo simulation. \(\|\mathbf{E}_{k}^{m}-\mathbf{E}_{k}\|\) is the error of the AUV position estimation at sample-index \(k\).  
At the \(m\)-th Monte-Carlo simulation (\(m\in\{1,2,\ldots,M_{c}\}\)), one considers the estimation error, given by  
\[error_{k}^{m}=\|\mathbf{E}_{k}^{m}-\mathbf{E}_{k}\|. \tag{46}\]  
Then, at each sample-index \(k\), the following metric is utilized:  
\[meanE_{k}=\frac{\sum_{m=1}^{M_{c}}error_{k}^{m}}{M_{c}}. \tag{47}\]  
Also, at each sample-index \(k\), we define  
\[maxE_{k}=max_{m\in\{1,2,\ldots,M_{c}\}}error_{k}^{m} \tag{48}\]  
and  
\[minE_{k}=min_{m\in\{1,2,\ldots,M_{c}\}}error_{k}^{m}. \tag{49}\]In simulations, we plot \(meanE_{k}\), \(maxE_{k}\), and \(minE_{k}\) with respect to sample-index \(k\).