I'm trying to solve the TDoA Multilateration problem, in three dimensions. That is, given the coordinates of 4 receivers in 3D space, the velocity of some signal, and the time at which each receiver "saw" the signal, I want to determine the coordinates of the signal source. To sum things up:
Known:
Coordinates of 4 observers (call them A, B, C, D)
Time of arrival of signal at each observer (call them $t_A$, $t_B$, $t_C$, $t_D$).
Velocity of the signal (call it $v$).
Unknown:
Time of signal emission (call it $t_i$)
Coordinates of signal source (call it $(x_i, y_i, z_i)$).
My Problem:
This is, in general, not a trivial problem so solve. It can, of course, be described by a nonlinear system. Many "standard" methods, however, quickly fail (Newton's method, etc.). My case is further complicated by the following:
In my specific situation, the signal in question is a light signal moving through a medium with a "complex" index of refraction. That is, the velocity of light depends upon depth, following the function:
$$n = 1.3 + 0.5(1 - e^{-0.02d})$$
Where $n$ is the index of refraction, and $d$ is depth.
For a simple refractive index, $n = \frac{c}{v}$, where $c$ is the speed of light (in a vacuum), and $v$ is the speed of light in the medium.
The goal here is to implement an algorithmic solution (i.e. in code), so as to process a large amount of signals quickly, determining the coordinates of each signal source as efficiently as possible.
How can this be done?
I change notations since yours at not very clear to me.
I worked this problem many years ago with the problem of sound velocity in deep water (my code was working on-line and had to be very fast).
Normally, for the observer $i$, the equation write $$\sqrt{(X-x_i)^2+(Y-y_i)^2+(Z-z_i)^2 }=v_i(Z)\, (t_i-T)$$ where
This makes four variables $(X,Y,Z,T)$ and I am not sure that four observers would be sufficient (except if there is absolutely no noise).
After trying many things without success, I decided to use the following iterative procedure : fix the velocity at a given value and solve the problem. From the results, update the $v_i(Z)$ and repeat again and again until the system stabilizes.
Edit
In my answer to this question, everything as based on the fact that, for observer $i$, the equation was $$(X-x_i)^2+(Y-y_i)^2+(Z-z_i)^2 =\big[v_i(Z)\, (t_i-T)\big]^2$$ while, in fact, we want is to minimize $$\text{SSQ}=\frac12\sum_{i=1}^n \Big[\sqrt{(X-x_i)^2+(Y-y_i)^2+(Z-z_i)^2 }-v_i(Z)\, (t_i-T)\Big]^2$$ which is a "bit" different.
For convenience, I shall note $D_i=\sqrt{(X-x_i)^2+(Y-y_i)^2+(Z-z_i)^2 }$
So, now, in order to polish the solution (and this step is important), we need to solve for $(X,Y,Z,T)$ the four equations $$\frac{\partial \text{ SSQ}}{\partial X}=\sum_{i=1}^n\frac{(X-x_i) (D_i-v_i(Z) (t(i)-T))}{D_i}=0$$ $$\frac{\partial \text{ SSQ}}{\partial Y}=\sum_{i=1}^n\frac{(Y-y_i) (D_i-v_i(Z) (t(i)-T))}{D_i}=0$$ $$\frac{\partial \text{ SSQ}}{\partial Z}=\sum_{i=1}^n (D_ i-v_i(Z) (t_i-T)) \left(\frac{Z-z_i}{D_i}-(t_i-T) v_i'(Z)\right)=0$$ $$\frac{\partial \text{ SSQ}}{\partial T}=\sum_{i=1}^n v_i(Z) (D(i)-v_i(Z) (t(i)-T))=0$$