Solving 4 equations with 4 unknowns.
Show older comments
hello everyone!
i have been trying to solve 4 equations with 4 unknowns but the result the code has been producing each time is a structure with values of 4 variables all equal to 0. Shown below is the code and the error.

% velocity of EM signal propagation %
c = 3e8; % meters per second %
% assuming errors for reference station %
Ir = 10e-9; % Ionospheric error, seconds %
Tr = 1.5e-9; % Tropospheric error, sedconds %
Er = 12e-9; % Ephemeris error, seconds %
Mr = 1e-9; % Multipath error, seconds %
Rr = 1e-9; % Reciever's noise, seconds %
Dr = 0.5e-9; % Dilution of precsion, seconds %
%total error in reference station's pseudorange%
Tr = c*(Ir + Tr + Er + Mr + Rr + Dr);
% Assumed pseudoranges of the satellites 1,2,3 and 4 from the user U %
Ru1 = 222;
Ru2 = 234;
Ru3 = 246;
Ru4 = 258;
syms x
syms y
syms z
syms t
equation1 = Ru1 - ((((S1(1,1) - x)^2 + (S1(1,2) - y)^2 + (S1(1,3) -z)^2)^0.5) + c*t + Tr);
equation2 = Ru2 - ((((S2(1,1) - x)^2 + (S2(1,2) - y)^2 + (S2(1,3) -z)^2)^0.5) + c*t + Tr);
equation3 = Ru3 - ((((S3(1,1) - x)^2 + (S3(1,2) - y)^2 + (S3(1,3) -z)^2)^0.5) + c*t + Tr);
equation4 = Ru4 - ((((S4(1,1) - x)^2 + (S4(1,2) - y)^2 + (S4(1,3) -z)^2)^0.5) + c*t + Tr);
sol = solve(equation1,equation2,equation3,equation4);
thank y'all for your inputs in advance.
Answers (2)
Nikhil Sonavane
on 31 Jan 2020
0 votes
Can you share S1, S2 and S3 matrices which you are using?
1 Comment
Walter Roberson
on 31 Jan 2020
They just happen to be completely visible in the image of the IDE:
S1 = [118, 118, 117];
S2 = [130, 130, 130];
S3 = [140, 140, 140];
S4 = [152, 152, 152];
Nikhil Sonavane
on 31 Jan 2020
Edited: Nikhil Sonavane
on 31 Jan 2020
0 votes
You can refer to the Tips section of the documention of solve function. It states that "If solve cannot find a solution and ReturnConditions is true, solve returns an empty solution with a warning. If no solutions exist, solve returns an empty solution without a warning". I would suggest you check if your system of equations have a solution.
1 Comment
Walter Roberson
on 31 Jan 2020
Maple is not finding any solution. I am working on some step-by-step work in Maple that just might find a solution.
Categories
Find more on Numeric Solvers 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!