Extract solutions solve error

I cannot figure out how to solve this warning error.
Warning: Could not extract individual solutions. Returning a MuPAD set object. > In solve>assignOutputs at 104 In solve at 87 In DOF_6 at 54
I've looked online and found someone else with the same error http://www.mathworks.com/matlabcentral/answers/927-help-using-solve-function-with-inputting-a-known-variable but it seems that his problem is different than mine.
I will post my entire code, but as you will notice, i have tried to break the problem into chunks but even then the warning pops up. any help would be greatly appreciated.
SR = [16.9175 12.502 15.8187 12.9719];
SR_ = [12.5399 16.8893 13.8293 15.0748];
Base = [4 4 2 2];
Base_ = [4 4 2 2];
syms A B C X Y Z positive;
syms SW SH SL positive; % positive only variables
syms az phi rho; % positive or negative variables
%%equations
% 3 equations for SH, SL, SW
Eq(1) = SR_(3)^2 - (SH - Base_(3))^2 - (SR_(4)^2 - (SH + Base_(4))^2);
Eq(2) = SR_(1)^2 - SH^2 - (SW^2 + (SL - Base_(1))^2);
Eq(3) = SR_(2)^2 - SH^2 - (SW^2 + (SL + Base_(2))^2);
% 6 equations for X,Y,Z, A,B,C
Eq(4) = SR(1)^2 - (SH + Z)^2 - ((SW + X)^2 + (SL + Y)^2);
Eq(5) = SR(2)^2 - (SH - Z)^2 - ((SW - X)^2 + (SL - Y)^2);
Eq(6) = SR(3)^2 - (SH + C)^2 - ((SW + A)^2 + (SL + B)^2);
Eq(7) = SR(4)^2 - (SH - C)^2 - ((SW - A)^2 + (SL - B)^2);
Eq(8) = SR(4)^2 - (SL - B)^2 - ((SW - A)^2 + (SH - C)^2);
Eq(9) = SR(1)^2 - (SL + Y)^2 - ((SW + X)^2 + (SH + Z)^2);
% 3 equations for az, phi, rho
Eq(10) = 'phi - (acos(C/Base(4)))';
Eq(11) = 'az - acos(A/(Base(4)*sin(phi)))';
Eq(12) = 'rho - asin(Z/(Base(1)*sin(phi)))';
%%solve
%S = solve(Eq(1),Eq(2),Eq(3), SW, SL, SH); %this works fine
% this one has the warning
S = solve(Eq(1), Eq(2), Eq(3), Eq(4), Eq(5), Eq(6),...
Eq(7), Eq(8), Eq(9), SW, SL, SH, X, Y, Z, A, B, C);
%this one has the warning also
%S = solve(Eq(1), Eq(2), Eq(3), Eq(4), Eq(5), Eq(6),...
% Eq(7), Eq(8), Eq(9), Eq(10), Eq(11), Eq(12),...
% SW, SL, SH, X, Y, Z, A, B, C, az, phi, rho);
thanks, darren
EDIT: i have fixed the name of B so that it is not over defined

 Risposta accettata

Andrew Newell
Andrew Newell il 26 Apr 2011
I tried renaming your vector B, but still get the same warning when running in the MATLAB workspace. However, in MuPAD I do get a solution. Call mupad and then enter:
SR := matrix(1,4,[[16.9175, 12.502, 15.8187, 12.9719]]);
SR2 := matrix(1,4,[[12.5399, 16.8893, 13.8293, 15.0748]]);
B1 := matrix(1,4,[[4, 4, 2, 2]]);
B2 := matrix(1,4,[[4, 4, 2, 2]]);
Eq1 := SR2[3]^2 - (SH - B2[3])^2 - (SR2[4]^2 - (SH + B2[4])^2);
Eq2 := SR2[1]^2 - SH^2 - (SW^2 + (SL - B2[1])^2);
Eq3 := SR2[2]^2 - SH^2 - (SW^2 + (SL + B2[2])^2);
Eq4 := SR[1]^2 - (SH + Z)^2 - ((SW + X)^2 + (SL + Y)^2);
Eq5 := SR[2]^2 - (SH - Z)^2 - ((SW - X)^2 + (SL - Y)^2);
Eq6 := SR[3]^2 - (SH + C)^2 - ((SW + A)^2 + (SL + B)^2);
Eq7 := SR[4]^2 - (SH - C)^2 - ((SW - A)^2 + (SL - B)^2);
Eq8 := SR[4]^2 - (SL - B)^2 - ((SW - A)^2 + (SH - C)^2);
Eq9 := SR[1]^2 - (SL + Y)^2 - ((SW + X)^2 + (SH + Z)^2);
S := solve([Eq1,Eq2,Eq3,Eq4,Eq5,Eq6,Eq7,Eq8,Eq9],[A,B,C,X,Y,Z,SW,SH,SL]);
The answer won't display in this answer box.
EDIT: You can determine how many solutions there are using
nops(S)
(the answer is 8) and look at each solution using, e.g.,
S[1]
Note that the solutions for some of the variables such as A are not isolated points but surfaces (functions of the parameters z and z1). Thus, defining the variables as positive doesn't necessarily reduce the number of solutions, and when I tried it I got a complicated mixture of intersections and unions of sets.
You can create the MATLAB code for each solution using a series of commands like
print(Unquoted,generate::MATLAB(S[1]))
You'll have to copy and paste each output to the Command Window or an m-file.

9 Commenti

Darren
Darren il 26 Apr 2011
thanks so much for your help andrew!
good catch with the overdefined B, bummer that wasn't the problem :)
a couple of questions.
1) am i hosed with regard to matlab? should i expect to need mupad to solve this problem? I really prefer it to stand alone in matlab but if that's out of question then I'll go to mupad.
2) I've run your code in Mupad (which I've never run code for and hence don't know much about) and the answer that returns has extra variables. i suspect this is because the variables being solved for are not defined as positive and thus there are a couple of different possible answers. how can I grab the one physical answer (i.e. all entities are positive) that i know exists (i've got a rig set up and have the answers waiting, to double check matlab)?
3) is there any way to extract these answers and assign them to variables like I would in Matlab so I can manipulate them further?
thanks for your help. i feel like we're really close to the answer, just not quite there!
Andrew Newell
Andrew Newell il 26 Apr 2011
1) I don't know. I couldn't make it work in MATLAB, and I don't know why it doesn't work. Someone else might be able to.
2) Unfortunately, it doesn't appear to be that simple (see my edits above).
Andrew Newell
Andrew Newell il 26 Apr 2011
3) I have added some more to the answer.
Darren
Darren il 26 Apr 2011
thanks again andrew for your help!
I can live with the answer to 3), thats not a problem
with regard to question 1), i guess i'll hope someone can help me make it all work in matlab, but until then, i'll try and figure it out in mupad with your gracious help.
what is puzzling is the fact that some of the variables solve as surfaces. like i said before, i rigged the whole thing up and there is a definitive, physical answer with all variables resolved as positive real numbers. I should get a set of solutions that includes this answer when i input these specific values for SR, (i have now changed the B matrix to be Base), etc. for instance, the answer to C should be 1.7321. i imagine this solution IS in the surface described by the mupad answer, but I want mupad to evaluate it (or I can evaluate it). is it possible that I'm solving equations that are not linearly independent and that is what is causing the solution with extra variable dependence? (its been a while since i took a linear algebra class, but i do remember the equations had to be orthogonal on the variables being solved for). any suggestion for how to get around that?
I have more pythagorean equations that i could use, but matlab doesn't like 11 equations in 9 variables and what not.
thanks so much for your help andrew, i really appreciate it
Darren
Darren il 26 Apr 2011
another possibity is perhaps i have some sort of recursion going on. could that be what is causing the surface answers
Darren
Darren il 26 Apr 2011
another interesting clue
when i define in mupad C:=1.7321 and Z := .8452, the solution set nolonger has the surface answers, and has a number of answers that are very close (likely rounding) with wrong signs (which i can live with)
Andrew Newell
Andrew Newell il 26 Apr 2011
I don't have the time to make a study of these equations, but I can comment on your last observation. In the solution sets, C=z1 and Z=z; so you could just as well say that A is a function A(C,Z). That's why your surfaces disappear.
Darren
Darren il 26 Apr 2011
thats what i thought. THanks for your help andrew. i'll keep working at it and see what I can figure out
By changing the variables you ask to solve for, you can find C in terms of B. The solution will have two half-arcs that together form a narrow ellipse in B. I would have to investigate to see if the arcs meet or if there is a small gap between their end points.
There may be other variables that could be left free instead. I am not certain, though, whether it is possible to define Z in terms of any of them. The structure of the equations suggests that it might be possible.

Accedi per commentare.

Più risposte (1)

Andrew Newell
Andrew Newell il 26 Apr 2011

0 voti

You have a variable B that starts out as a vector with numerical values and then becomes a variable.

Community Treasure Hunt

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

Start Hunting!

Translated by