Extract solutions solve error

6 views (last 30 days)
Darren
Darren on 26 Apr 2011
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

Accepted Answer

Andrew Newell
Andrew Newell on 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 Comments
Darren
Darren on 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
Walter Roberson
Walter Roberson on 27 Apr 2011
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.

Sign in to comment.

More Answers (1)

Andrew Newell
Andrew Newell on 26 Apr 2011
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!