Why does solve not return more than 2 answers

Hi i've been practising some concepts from a uni course by using MATLAB as a demonstration tool.
The function below should solve for x and y coordinate of a robot based on a range measurement to a landmark.
However, if i have one landmark, theoretically I should have infinite solutions of x and y. Whilst i understand its not possible to recieve unlimited solutions, I should be receiving more than 2. What is wrong in my implementation?
function Loc = FindLocation()
syms x y
global landmarks
for i = 1:landmarks.N
range(i) = (landmarks.pose(i).r)^2 == ((landmarks.pose(i).x - x)^2 + (landmarks.pose(i).y - y)^2)
end
sol = solve(range(1:end),[x,y]);
Loc.x = sol.x
Loc.y = sol.y
end
Thanks in advance

1 Comment

What value is landmarks.N (that is, what size is landmarks.pose ?)

Sign in to comment.

Answers (1)

sol = solve(range(1:end), [x,y], 'returnconditions', true);
This will return sol.x and sol.y parameterized by an extra variable that will probably be named z or z1 or something like that.
fplot3(sol.x,sol.y,sym([0;0]),[-20 20])

Asked:

on 24 Jun 2018

Answered:

on 24 Jun 2018

Community Treasure Hunt

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

Start Hunting!