I am currently working on a project where i need to be able to find a sound source based on three microphones. The sound source is located between 15-20 meters away from the microphone array.
The microphones have set positions as $(x_1,y_1)$, $(x_2, y_2)$, $(x_3, y_3)$ and the distances between them are known.
If one define the sound sources position as $(x_p, y_p)$ and the time for the source to reach each microphone as $T_i$, it is possible to setup the three equations:
- $\sqrt{(x_p -x_1)^2 +(y_p - x_1)^2} = c*T_1$
- $\sqrt{(x_p -x_2)^2 +(y_p - x_2)^2} = c*T_2$
- $\sqrt{(x_p -x_3)^2 +(y_p - x_3)^2} = c*T_3$
taking the time differences $T_2 - T_1$ , $T_3-T_1$ and $T_3- T_2$, we can set up
$ \frac{1}{c}( \sqrt{(x_p -x_2)^2 +(y_p - x_2)^2} - \sqrt{(x_p -x_1)^2 +(y_p - x_1)^2} )= T_2 - T_1$
$ \frac{1}{c} (\sqrt{(x_p -x_3)^2 +(y_p - x_3)^2} - \sqrt{(x_p -x_1)^2 +(y_p - x_1)^2} )= T_3 - T_1$
$ \frac{1}{c}( \sqrt{(x_p -x_3)^2 +(y_p - x_3)^2} - \sqrt{(x_p -x_2)^2 +(y_p - x_2)^2} )= T_3 - T_2$
Since $T_i - T_j$ are known, we have a set of three equations with two unknown. I am wondering how to solve the last one for $x_p$ and $y_p$, or alternatively find the angle from $(0,0)$ to $(x_p, y_p)$
Edit: I have searched around and i see that the approach is typically sum of least squares, but i will still appreciate any help on how it works
Edit2: Forgot parenthesis on two of the equations
You can use nonlinear least squares estimation to find the optimal solution. For this define $$f_{ij}(u) := \sqrt{(x_p-x_i)^2+(y_p-y_i)^2} - \sqrt{(x_p-x_j)^2+(y_p-y_j)^2}$$ where $u^T := \begin{bmatrix}x_p & y_p\end{bmatrix}$. Create the Jacobian matrix as $$J=\frac{\partial f(u)}{\partial u}$$ Now, starting from an initial location $u^*$ solve the equation $$b=J|_{u=u^*}u$$ using least squares estimation where $b_{ij} = c(T_i - T_j)$. Now use this new solution as $u^*$ and solve the equation again until the solutions converge, i.e. solution is close the $u^*$. This way you can find the geometric center of the triangle, whose corners are the intersection of the parabolas defined by $f_{ij}$.