In solving equation using 'solve', I tried to change the constant part by a small value say 0.1. But, If I change the value by 0.1 the solution is completely different and far away from the exact solution. Is there any solution?

syms x y z
a = (sqrt((x-SatPos(1,1))^2+(y-SatPos(1,2))^2+(z-SatPos(1,3))^2)==Dis(1));
b = (sqrt((x-SatPos(2,1))^2+(y-SatPos(2,2))^2+(z-SatPos(2,3))^2)==Dis(2));
c = (sqrt((x-SatPos(3,1))^2+(y-SatPos(3,2))^2+(z-SatPos(3,3))^2)==Dis(3));
d = (sqrt((x-SatPos(4,1))^2+(y-SatPos(4,2))^2+(z-SatPos(4,3))^2)==Dis(4));
sol= solve(a,b,c,d);
If I change the value of Dis(1), Dis(2), Dis(3) and Dis(4) by small amount (say by <0.5), the final value of x,y,z are not nearby the exact solution. Is there any way to solve it?
Your suggestion would guide my project a lot.
Thanks in advance!

 Accepted Answer

No, you are solving 4 equations in 3 unknowns. The only time there would be a solution would be if the system is over-determined, which is unlikely to be the case in these equations.

7 Comments

The problem is same if I take 3 equations too. I just increased the number of equation to see if the solution would come near by the value
The symbolic solutions are pretty long. Could you give some sample values to test with?
SatPos =
0 0 9500.5
100 0 9700
0 100 9500
50 50 9800
dis =
9200.7 9400.4 9200.2 9500
Exact Output should be [25 50 300]. But when I change by small margin say
Dis = 9200.8 9400.7 9200.4 9500
output is way beyond and not near by to the exact solution.
Hope you will give me some solution.
The symbolic expressions are really long.
When you substitute in those SatPos distances into the first three equations, then for example
x = (101/99601)*Dis1^2 + 19960499/398404 - (40001/39840400)*Dis2^2 - (399/39840400)*Dis3^2 - (399/39840400)*(-240000*Dis1^4 + (80800*Dis2^2 + 399200*Dis3^2 - 47880000)*Dis1^2 - 40001*Dis2^4 + (-798*Dis3^2 + 3992099800)*Dis2^2 - 199201*Dis3^4 + 4023860200*Dis3^2 - 119523588015000)^(1/2)4+4023860200*Dis3^2-119523588015000)^(1/2)
You might notice that this involves the 4th powers of each of the distances, and multiplied by large factors. With the original second and third distances, the slope is roughly +90 so a change of 0.1 in the first distance would result in a change of about 9 in x.
The equations are nonlinear and with the inputs you are giving, a change of 0.1 in a single distance has a large effect.
Thank You for your elaboration.
So, is there any way to solve this problem? Any other matlab function instead of solve which would not deviate my solution a lot.
Imagine that you have a 1 cm x 1cm by 1 cm block of wood. You can balance it easily on your finger tips. If you make it 1 cm x 1 cm x 2 cm and put that tall side upward, you can probably still handle it quite easily on your finger tips. If you make it 1 cm x 1 cm x 10 cm tall side pointing upwards, then small movements in your fingertips are going to be magnified a fair bit, tiny little tremors ("errors") get magnified, but with a small bit of practice you could probably still do a fair job of keeping it balanced. Now make it 1 cm x 1 cm x 90 cm tall side upwards. Tiny tremors are going to cause it to swing wildly. A tremor as big as 1/10th cm is going to have a major effect on the position of the top of the block.
Is there a way different way of balancing the block that would allow a tremor as large as 1/10th cm to barely move the top of the block? Obviously not. The "solution" to keep the block balanced is to find a way to reduce your tremors (shaking) considerably.
The errors in your input distances correspond to the "tremors" I describe for the balancing task. If you are not able to measure your inputs to within 0.01 then your output is going to change by more you are willing to accept. That is not the fault of the equations or the technique used to solve them: it is the fault of your expectations about the calculations you are doing.
Thank you very much for your suggestion. I will keep that in my mind and try to have lower shifts as possible.
But, the actual problem is the shifts I am making is too low. Actually I am trying to solve GPS positioning problem.
I will try to look for other alternatives.
Anyways thanks for your time and suggestion.

Sign in to comment.

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!