The solution found to the equations for three sensors (x,y and amplitude) can be reduced to the following C-code which is valid in one plane. All variables below are type float in C:

Main(){

Float a, b, vdet1, vdet2, vdet3, d, g, h, x, y

Float angle, scale, intensity

a = vdet1/vdet2;

b = vdet1/vdet3;

 

// constant d is distance between sensors and origin. In this case,

// the sensors are located at (2,0), (-2,0), and (0,2). Change d for your

// application, i.e. for sensors 4 inches from origin use d=4

d = 2;

g = 4*(a*a) – 8*b + 4 + 8*b*b – 8*a*b;

// g is an intermediate variable

h = 2 + 2*a + 2*sqrt(2*a – 1 – a*a + 4*b – 4*b*b + 4*a*b)

// h is an intermediate variable

x = -h*(a - 1)*d/g

y = h*(a - 2*b + 1)*d/g

angle = atan2(y,x)*360/6.28; // angle to source

//I is the intensity of the source.

scale = 3; // scale is adjusted based on constants k in the formula

intensity = vdet1*(4*d*d*h)/(g*scale);

}