# Using triangulation

I have been presented with 3 known points and the power densities at those points. I need to use those points to find the location of the actual antenna which is generating the signals.

Power Density is calculated through $PD=(power by antenna)/4*Pi*R^2$

and the inverse law also applies, $PD=\frac{1}{R^2}$, where R is the distance between a known point and the antenna.

What is the best method of apporaching this problem using the Mathematica enviroment? Till now I havent been able to tackle this problem mathematically aswell, as I don't know how it would be done.

I did however come across something, which said plotting circles will be the best, and their intersections will give the coordinates? how will this work?

This is the module where I have to write the code:

Triangulate[measure_] := Module[(* Enter your code here*)]


measure_ contains 3 lists, e.g you would input

Triangulate[{{2000,0,1/2},{0,1000,1},{0,0,1/2}}]


where first two elements are the x and y coordinates, and the last element is the power density at those points.

Any help to get me started will be appreciated, cause at the moment i dont know how to start or tackle this.

-
Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the FAQs! 3) When you see good Q&A, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. ALSO, remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign – chris Oct 27 '12 at 20:49
Pedantically speaking this is not triangulation, since it doesn't rely on measurement of angles. Instead the solution relies on estimating distance using known signal strength drop over distance; it's called trilateration. – kirma Oct 28 '12 at 10:45
Are you and this user mathematica.stackexchange.com/questions/13786/… the same person? – Dr. belisarius Oct 28 '12 at 12:31
haha no thats not me, but thats someone who is doing the same assignment as me – Daniel R Oct 28 '12 at 12:59
Oh god... they are multiplying! – István Zachar Oct 29 '12 at 20:33

I assume (sorry if I'm being wrong) that this is some kind of homework. So I've written an answer as guidance. You'll have to work out some details.

If your problem is three dimensional, you can write for example:

dist[x0_,x1_] := (x0-x1).(x0-x1);
power[x0_,x1_]:= c/dist[x0,x1];
findAnt[{{pow1_,pos1_},{pow2_,pos2_},{pow3_,pos3_}}]:=
Solve[power[{x0,y0,z0},pos1]==pow1 &&
power[{x0,y0,z0},pos2]==pow2 &&
power[{x0,y0,z0},pos3]==pow3,{x0,y0,z0}];


and find the antenna position for a certain configuration as:

findAnt[{{c/2, {1, 0, 0}}, {c/2, {0, 1, 0}}, {c/2, {0, 0, 0}}}]

(*
-> {{x0 -> 1/2, y0 -> 1/2, z0 -> -Sqrt[(3/2)]},
{x0 -> 1/2, y0 -> 1/2, z0 ->  Sqrt[3/2]}}
*)


Or, if you want to write the function in more a compact form:

findAnt[l:{{_, _}..}]:=Solve[And@@(power[{x0,y0,z0}, #[[2]]] == #[[1]]&/@ l), {x0,y0,z0}];


Now you can visualize the possible antenna positions and the measurement points, along with their equipotential surfaces like this:

l   = {{c/2, {1, 1, 0}}, {c/4, {0, 1, 1}}, {c/4, {0, 0, 0}}};
sol = findAnt[l];

Graphics3D[{PointSize[.05], Blue, Point[l[[All, 2]]],
Red,  Point[{x0, y0, z0} /. sol],
Green, Opacity[.2], Specularity[White, 1],
{Sphere[{x0,y0,z0} /.sol[[1]], EuclideanDistance[{x0, y0, z0} /. sol[[1]], #]],
Sphere[{x0,y0,z0} /.sol[[2]], EuclideanDistance[{x0, y0, z0} /. sol[[2]], #]]}&/@
l[[All, 2]]}]


Edit:

If the power of the antenna is unknown, you can only solve a 2D problem is still easy to solve:

(*assuming an antenna of unknown power*)
dist[x0_, x1_]  := (x0 - x1).(x0 - x1);
power[x0_, x1_] := c/dist[x0, x1];
findAnt[l:{{_, _} ..}] := Solve[And@@(power[{x0, y0}, #[[2]]] == #[[1]]&/@ l), {x0, y0, c}];

l   = {{1/2, {1, 0}}, {1/15, {0, 3}}, {1/2, {0, 0}}};
sol = findAnt[l];

Graphics[
{PointSize[.05], Blue, Point[l[[All, 2]]], Red, Point[{x0, y0} /. sol],
Green, Dashed,
{Circle[{x0, y0}/. sol[[1]], EuclideanDistance[{x0, y0}/. sol[[1]], #]],
Circle[{x0, y0}/. sol[[2]], EuclideanDistance[{x0, y0}/. sol[[2]], #]]} &/@ l[[All, 2]]}]


And you can show the equipotential curves and the measurement positions for the above solution like this:

Show[Plot3D[{power[{x0, y0}, {x, y}] /. sol[[1]],
power[{x0, y0}, {x, y}] /. sol[[2]]}, {x, -5, 5}, {y, -5, 5},
Mesh -> {{1/2, 1/15}}, PlotRange -> {0, .6},
ClippingStyle -> Opacity[0.5],  MeshFunctions -> {#3 &},
PlotStyle -> {{Green, Directive[Opacity[.3], Specularity[3]]},
{Red,   Directive[Opacity[.4], Specularity[3]]}}],
Graphics3D[{PointSize[.03], Blue,
Point@Join[#, {power[{x0, y0}, #]}] & /@ l[[All, 2]] /. sol[[1]]}]]


Finally, I want to mention a method that is probably out of the scope of your homework, but can take advantage of the utilization of more than three sensors by using minimization techniques on the potential parameters:

model = c/ ((x0 - x)^2 + (y0 - y)^2 + (z0 - z)^2);
(* data is {x, y, z, power} *)
data = {{1, 0, 0, 1/2}, {0, 1, 0, 1/2}, {0, 0, 0, 1/2}};
fit = NonlinearModelFit[data, model, {c, x0, y0, z0}, {x, y, z}];
fit["BestFitParameters"]
(*
-> {c -> 1.25371, x0 -> 0.5, y0 -> 0.5, z0 -> 1.41684}
*)


And now you can test that the solution really fits the input data:

model /. fit["BestFitParameters"] /. Thread[{x, y, z} -> #] & /@ data[[All, 1 ;; 3]]
(*
->  {0.5, 0.5, 0.5}
*)

-
@DanielR Have you read my answer? Those numbers were calculated using the code under the (*assuming an antenna of unkown power*)` comment – Dr. belisarius Oct 28 '12 at 12:16
@DanielR That is your homework. We usually don't provide direct and complete answers to homework questions here – Dr. belisarius Oct 28 '12 at 13:00
For this one time please? – Daniel R Oct 28 '12 at 13:02
Pretty pretty please – Rojo Oct 28 '12 at 20:02
Even when the power is unknown, there are solutions. In fact, given three points and three power readings, you can estimate the source location, the power, and even the typical amount of error in the readings. After all, the data provide nine pieces of information and we only need to get three pieces back out of the procedure. – whuber Oct 29 '12 at 19:08