# Acoustic TDOA Measurement and Accurate Indoor Positioning for Smartphone
## 3 Robust TDOA Measurement Method
### Static Robust Positioning Algorithm Base on TODA  
Figure 9 represents the fundamental mathematical model utilized in this article. \(S_{i}\) represents the acoustic node \(i\). \(R\) represents the internal microphone of smartphone. TDOA needs to be converted into distance difference for positioning. The formula is as follows:  
\[\Delta d_{i}=d_{1}-d_{i+1}=TDOA_{i}\cdot c\quad i=1,2,3 \tag{4}\]  
where \(c\) is the speed of sound, \(c\) is 340 m/s at 15 entigrade. \(\Delta d_{i}\) is the distance difference. \(d_{1}\) is the distance from the smartphone to the reference node. In this paper, acoustic node 1 is the reference node. Suppose \(r(x,y)\) is the actual coordinate of the smartphone, and \(s_{i}(x_{i},y_{i})\) is the coordinate of the acoustic node. \(d_{i}\) is the distance from the smartphone to the acoustic node \(i\). The \(d_{i}\) is calculated as follows:  
\[d_{i}=\sqrt{\left(x-x_{i}\right)^{2}+\left(y-y_{i}\right)^{2}}\quad i=1,2,3,4 \tag{5}\]  
Substitute Formula (5) into Formula (4) to obtain Formula (6):  
\[\Delta d_{i}=\sqrt{\left(x-x_{1}\right)^{2}+\left(y-y_{1}\right)^{2}}-\sqrt{ \left(x-x_{i+1}\right)^{2}+\left(y-y_{i+1}\right)^{2}}\quad i=1,2,3 \tag{6}\]By assuming that all the anchor positions are known, \(p_{i}\) is the actual measured distance difference, which is related to TDOA measurement. Although we have optimized the TDOA detection algorithm, we cannot completely eliminate the TDOA measurement error. So \(p_{i}\) also include errors. \[n_{i}=p_{i}-\Delta d_{i}\quad i=1,2,3 \tag{7}\]  
where \(n_{i}\) is the measurement error. In order to establish the relationship between the measured distance difference \(p_{i}\) and the smartphone position \(r(x,\,y)\), we substitute (5) into (6) to obtain three equations. So, the least squares condition is usually considered to estimate position \(R(x^{\prime},y^{\prime})\). \[R=argmin\sum_{i=1}^{3}(p_{i}-\Delta d_{i})^{2} \tag{8}\]  
It is easy to see that the problem of solving Formula (8) is a nonlinear problem. In order to observe the performance of positioning algorithms, we carried out a static positioning simulation. We choose two commonly positioned algorithms as the comparison: the Chan method and the ML method. Chan method is a linear estimator that can convert nonlinear problems into linear problems. ML method is a nonlinear estimator, which directly solves optimization problems. These two methods are representative. We simulate and analyze these two positioning methods to obtain a robust positioning algorithm for two scenes. The first scene is 4.8 m \(\times\) 4.8 m in size. The second scene is 6.4 m \(\times\) 7.9 m in size. We set the standard deviation of noise to 1. The distribution of acoustic nodes and test points is shown in Figure 10. In scenario 1, the coordinates of the four acoustic nodes are (0.0 m, 0.0 m), (4.8 m, 0.0 m), (4.8 m, 4.8 m), (0.0 m. 4.8 m). We select the test points A (2.4 m, 2.4 m) in scenario 1. In the simulation of scenario 2, the coordinates of the four acoustic nodes are (0.0 m. 0.0 m), (0.0 m, 6.4 m), (7.9 m, 6.4 m), (7.9 m, 0.0 m). We select the test points B (2.4 m, 4 m) in scenario 2. Simulating 100 times at each test point (A and B). The positioning results of point A and point B are as shown below:  
Figure 10: Comparison of CHAN method and ML method: (**a**) positioning result of point A by using Chan method and ML method; (**b**) positioning result of point B by using Chan method and ML method. Figure 9: Mathematical model of positioning. From Figure 10, it can be seen that the positioning accuracy of the Chan method is lower than that of the ML method under the condition that the standard deviation of the noise is 1. Therefore, the Chan method is not used at last. Under the condition that the standard deviation of the noise is set as 1, we make statistics on the positioning results of point A in scenario 1 and B in scenario 2. As shown in Figure 11, we obtained the positioning results by using the ML algorithm.