LI Implementation: Complete!
I have finished implementing the LI estimator. I added noise in the form of additive zero-mean Gaussian noise with an adjustable variance. Here are some reports from MATLAB:
Report 1
Injected Gaussian Noise with mean=0 and variance=0.001
Final Estimate=[5.5941,3.7294,4.1864]
Source Location=[5.5909,3.728,4.1865]
Bias=1.2495e-005

Report 2
Injected Gaussian Noise with mean=0 and variance=0.01
Final Estimate=[5.1913,4.0379,2.1349]
Source Location=[5.0773,4.2012,2.0265]
Bias=0.051423

A closer look shows all points of closest intersection, the actual location of the source, and our final estimate.

This marks the end of my work exploring centralized methods. I now turn my attention to distributive sensor networks. Stay tuned!
Coordinate Change
Introduction
To simplify things in the LI estimator, we use a relative coordinate system like the one below.

However, we localize the source in a coordinate system relative to the room, which looks like this:

We need to have an algorithm that lets us change the coordinate system appropriately.
Coordinate Types
We can make the following assumptions about our microphone arrays:
- Microphones will never be at the origin of our relative system
- Microphones in a cluster will all lie in the same plane. This plane will be parallel to the xz plane or yz plane.
- The origin of a cluster will never be on an axis of a room.
With these assumptions, we can say that for a room with a width W and length L, the coordinates of the cluster will come in four types.
| Type | Coordinates |
| I | (x, 0, z) |
| II | (0, y, z) |
| III | (x, L, z) |
| IV | (W, y, z) |
Here’s an illustration of all 4 types:

This is important, because it guides how we do our transforms.
Step 1: Rotation
It’s possible that the line connecting m1 and m2 is not parallel to the x or y axis. To take this into account, we need to measure the angle the line has relative to the correct axis in the room coordinate system, and then rotate our cluster coordinate system by that amount about its z-axis. The formula for getting the angle is:

Where a and b are determined by the following table:
| Type | a | b |
| I | x | z |
| II | y | z |
| III | x | z |
| IV | y | z |
We then use our value of θ to rotate our coordinate axes. This is done by multiplying the vectors by a rotation matrix. This is something that can be done easily in MATLAB, so I won’t go into depth on it here. What I will say is that we have a MATLAB function:
R1 = rotate_rel_abs(M1, [ origin; kappa, theta, phi ]);
The function rotates the coordinate system through the three angles κ, θ, and φ, and translates it to the point given by the vector origin. The result is that M1 gets mapped to a corresponding vector R1 in a new coordinate system.
This first rotation is simple. The code for rotating a point M1 is as follows:
M1_r = rotate_rel_abs(M1, [0 0 0; 0 theta; 0]);
Step 2: Translation
We now need to take our point relative to our rotated microphone axes and translate it appropriately. We’ll use the following table to make the translation:
| Type | κ | θ | φ | Additional Transform |
| I | ![]() |
0 | 0 | y = -y |
| II | ![]() |
0 | ![]() |
N/A |
| III | ![]() |
0 | 0 | N/A |
| IV | ![]() |
![]() |
![]() |
x = 2L – x |
Conclusion
We can summarize the above in the following MATLAB code. Feel free to use it, but remember to cite me.






