My algorithm for hyperbolic localization not working while testing on known data set

I am trying to build a code that uses hyperbolic locationing using 3 'antennas' and one 'transmitor' all of known location to me and I try to see if my code can use the antena locations and the difference in distances of the transmitor to each couple of antennas to figure out where the transmitor is (I hope I was clear enough).
When I try it in 2D it works great.
When I expand it to 3D problems start.
I will add the code but first outline the problem -
the transmitor is located at (5,3,4) arbitrary units for now.
What my code gives back is: (5,5,4i)
So my issue is first that the y location is wrong and second that while the value of the z coordinate is correct it is imaginary whis is not good.
Can anyone maybe help me figure out how to fix it?
The code:
syms x y z
% coordinates of receivers
x1 = 1;
y1 = 6;
z1 = 0;
x2 = 4;
y2 = 1;
z2 = 0;
x3 = 9;
y3 = 5;
z3 = 0;
% distance to receivers
d1 = 6.48;
d2 = 4.61;
d3 = 6.02;
% equations for 3 hyperbulas
eq1 = sqrt((x-x1)^2 + (y-y1)^2 + (z-z1)^2)-sqrt((x-x2)^2 + (y-y2)^2 + (z-z2)^2)==(d1-d2);
eq2 = sqrt((x-x2)^2 + (y-y2)^2 + (z-z2)^2)-sqrt((x-x3)^2 + (y-y3)^2 + (z-z3)^2)==(d2-d3);
eq3 = sqrt((x-x3)^2 + (y-y3)^2 + (z-z3)^2)-sqrt((x-x1)^2 + (y-y1)^2 + (z-z1)^2)==(d3-d1);
% finding location of transmitter.
S = solve(eq1,eq2,eq3, [x y z]);
Again it works great when I do it only in 2D but thats not real life and my project where this will be implemented is in our 3D world.
Will apreciate any help
Thank you

4 comentarios

Hi Shashar,
It helps to start out with
syms x y z real
but a more fundamental problem is that the third equation is what you get when you sum the first two equations. In 3d you have two equations, three unknowns.
Hey David,
Thankyou! that did solve it and I get the correct coordinates now.
Thankyou very much, equation 3 being a combination of the first two was the big problem, can't belief I didn't notice myself :)
o.k. good although I don't know how you will get a well defined answer in 3d without adding a 4th receiver.
I have a 4th reciever, I just used only 3 in my analysis up to now. Just upgraded it to 4.

Iniciar sesión para comentar.

Respuestas (0)

Preguntada:

el 12 de Dic. de 2018

Comentada:

el 13 de Dic. de 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by