Explicit solution could not be found error

조회 수: 1 (최근 30일)
Steven
Steven 2011년 11월 8일
Hi,
I'm using the symbolical toolbox to solve a few matrix multiplication; there is one for each of the eight sub-cases. Running the code below gives the following message:
  1. Warning: 1 equations in 5 variables. New variables might be introduced.
  2. Warning: Explicit solution could not be found.
---EDIT--- I get those two warnings for each line I used the solve command to solve the matrix multiplication, so at
solve('mtimes(A_10, COEFF_0) = W',M,N,R,Q,q)
solve('mtimes(A_11, COEFF) = Disload',M,N,R,Q,w)
solve('mtimes(A_12, COEFF) = Disload',M,N,R,Q,w)
etc,
I first define 5x1 matrices with symbols in them, then I define the matrix A which is different for each case and is a 5x5 matrix, then I want to solve, in the first case, A_10 x COEFF_0 = W (matrix product)for the symbols M,N,R,Q,q. ---END EDIT---
Since it is a matrix multiplication it isn't one equations but 5, equal to the amount of variables that need to be solved.
syms M N R Q w K BETA GAMMA THETA M_1 M_2 M_0 q L E I Ec P;
COEFF_0 = [M ; N ; R ; Q ; q];
COEFF = [M ; N ; R ; Q ; w];
Disload = [-1/K ; 0 ; -1/K ; 0 ; -1/K];
W = [0 ; 0 ; 0 ; 0; 1];
%%CASE 1: Pin supported
%-----------------------
%P=0
A_10 = [1 0 1 0 1/K ; BETA*BETA-GAMMA*GAMMA 2*GAMMA*BETA BETA*BETA-GAMMA*GAMMA -2*GAMMA*BETA 0 ; exp(BETA*L)*cos(GAMMA*L) exp(BETA*L)*sin(M_1*L) exp(-BETA*L)*cos(GAMMA*L) exp(-BETA*L)*sin(GAMMA*L) 1/K ; exp(BETA*L)*((BETA*BETA-GAMMA*GAMMA)*cos(GAMMA*L)-2*GAMMA*BETA*sin(GAMMA*L)) exp(BETA*L)*(2*GAMMA*BETA*cos(GAMMA*L)+(BETA*BETA-GAMMA*GAMMA)*sin(GAMMA*L)) exp(-BETA*L)*((BETA*BETA-GAMMA*GAMMA)*cos(GAMMA*L)+2*GAMMA*BETA*sin(GAMMA*L)) exp(-BETA*L)*(-2*GAMMA*BETA*cos(GAMMA*L)+(BETA*BETA-GAMMA*GAMMA)*sin(GAMMA*L)) 0 ; exp(BETA*L/2)*cos(GAMMA*L/2) exp(BETA*L/2)*sin(GAMMA*L/2) exp(-BETA*L/2)*cos(GAMMA*L/2) exp(-BETA*L/2)*sin(GAMMA*L/2) 1/K];
solve('mtimes(A_10, COEFF_0) = W',M,N,R,Q,q)
%P>2sqrt(K*E*I)
A_11 = [1 0 1 0 0 ; -M_1*M_1 0 -M_2*M_2 0 0 ; cos(M_1*L) sin(M_1*L) cos(M_2*L) sin(M_2*L) 0 ; -M_1*M_1*cos(M_1*L) -M_1*M_1*sin(M_1*L) -M_2*M_2*cos(M_2*L) -M_2*M_2*sin(M_2*L) 0 ; cos(M_1*L/2) sin(M_1*L/2) cos(M_2*L/2) sin(M_2*L/2) -1];
solve('mtimes(A_11, COEFF) = Disload',M,N,R,Q,w)
%P=2*sqrt(K*E*I)
A_12 = [1 0 0 0 0 ; -M_0*M_0 0 0 2*M_0 0 ; cos(M_0*L) sin(M_0*L) L*cos(M_0*L) L*sin(M_0*L) 0 ; -M_0*M_0*cos(M_0*L) -M_0*M_0*sin(M_0*L) -2*M_0*sin(M_0*L)-L*M_0*M_0*cos(M_0*L) 2*M_0*cos(M_0*L)-L*M_0*M_0*sin(M_0*L) 0 ; cos(M_0*L/2) sin(M_0*L/2) L/2*cos(M_0*L/2) L/2*sin(M_0*L/2) -1];
solve('mtimes(A_12, COEFF) = Disload',M,N,R,Q,w)
%P<2*sqrt(K*E*I)
A_13 = [1 0 1 0 0 ; BETA*BETA-GAMMA*GAMMA 2*GAMMA*BETA BETA*BETA-GAMMA*GAMMA -2*GAMMA*BETA 0 ; exp(BETA*L)*cos(GAMMA*L) exp(BETA*L)*sin(GAMMA*L) exp(-BETA*L)*cos(GAMMA*L) exp(-BETA*L)*sin(GAMMA*L) 0 ; exp(BETA*L)*((BETA*BETA-GAMMA*GAMMA)*cos(GAMMA*L)-2*GAMMA*BETA*sin(GAMMA*L)) exp(BETA*L)*(2*GAMMA*BETA*cos(GAMMA*L)+(BETA*BETA-GAMMA*GAMMA)*sin(GAMMA*L)) exp(-BETA*L)*((BETA*BETA-GAMMA*GAMMA)*cos(GAMMA*L)+2*GAMMA*BETA*sin(GAMMA*L)) exp(-BETA*L)*(-2*GAMMA*BETA*cos(GAMMA*L)+(BETA*BETA-GAMMA*GAMMA)*sin(GAMMA*L)) 0 ; exp(BETA*L/2)*cos(GAMMA*L/2) exp(BETA*L/2)*sin(GAMMA*L/2) exp(-BETA*L/2)*cos(GAMMA*L/2) exp(-BETA*L/2)*sin(GAMMA*L/2) -1];
solve('mtimes(A_13, COEFF) = Disload',M,N,R,Q,w)
%%CASE 2: Embeddet
%------------------
%P=0
A_20 = [1 0 1 0 1/K ; BETA GAMMA -BETA GAMMA 0 ; exp(BETA*L)*cos(GAMMA*L) exp(BETA*L)*sin(M_1*L) exp(-BETA*L)*cos(GAMMA*L) exp(-BETA*L)*sin(GAMMA*L) 1/K ; exp(BETA*L)*(BETA*cos(GAMMA*L)-GAMMA*sin(GAMMA*L)) exp(BETA*L)*(BETA*sin(GAMMA*L)+GAMMA*cos(GAMMA*L)) exp(-BETA*L)*(-BETA*cos(GAMMA*L)-GAMMA*sin(GAMMA*L)) exp(-BETA*L)*(-BETA*sin(GAMMA*L)+GAMMA*cos(GAMMA*L)) 0 ; exp(BETA*L/2)*cos(GAMMA*L/2) exp(BETA*L/2)*sin(GAMMA*L/2) exp(-BETA*L/2)*cos(GAMMA*L/2) exp(-BETA*L/2)*sin(GAMMA*L/2) 1/K];
solve('mtimes(A_20, COEFF_0) = W',M,N,R,Q,q)
%P>2sqrt(K*E*I)
A_21 = [1 0 1 0 0 ; 0 M_1 0 M_2 0 ; cos(M_1*L) sin(M_1*L) cos(M_2*L) sin(M_2*L) 0 ; -M_1*sin(M_1*L) M_1*cos(M_1*L) -M_2*sin(M_2*L) M_2*cos(M_2*L) 0 ; cos(M_1*L/2) sin(M_1*L/2) cos(M_2*L/2) sin(M_2*L/2) -1];
solve('mtimes(A_21, COEFF) = Disload',M,N,R,Q,w)
%P=2*sqrt(K*E*I)
A_22 = [1 0 0 0 0 ; 0 M_0 0 1 0 ; cos(M_0*L) sin(M_0*L) L*cos(M_0*L) L*sin(M_0*L) 0 ; -M_0*sin(M_0*L) M_0*cos(M_0*L) cos(M_0*L)-L*M_0*sin(M_0*L) sin(M_0*L)+L*M_0*cos(M_0*L) 0 ; cos(M_0*L/2) sin(M_0*L/2) L/2*cos(M_0*L/2) L/2*sin(M_0*L/2) -1];
solve('mtimes(A_22, COEFF) = Disload',M,N,R,Q,w)
%P<2*sqrt(K*E*I)
A_23 = [1 0 1 0 0 ; BETA GAMMA -BETA GAMMA 0 ; exp(BETA*L)*cos(GAMMA*L) exp(BETA*L)*sin(GAMMA*L) exp(-BETA*L)*cos(GAMMA*L) exp(-BETA*L)*sin(GAMMA*L) 0 ; exp(BETA*L)*(BETA*cos(GAMMA*L)-GAMMA*sin(GAMMA*L)) exp(BETA*L)*(BETA*sin(GAMMA*L)+GAMMA*cos(GAMMA*L)) exp(-BETA*L)*(-BETA*cos(GAMMA*L)-GAMMA*sin(GAMMA*L)) exp(-BETA*L)*(-BETA*sin(GAMMA*L)+GAMMA*cos(GAMMA*L)) 0 ; exp(BETA*L/2)*cos(GAMMA*L/2) exp(BETA*L/2)*sin(GAMMA*L/2) exp(-BETA*L/2)*cos(GAMMA*L/2) exp(-BETA*L/2)*sin(GAMMA*L/2) -1];
solve('mtimes(A_23, COEFF) = Disload',M,N,R,Q,w)

답변 (2개)

Walter Roberson
Walter Roberson 2011년 11월 8일
Several places, you have lines similar to
solve('mtimes(A_23, COEFF = Disload)',M,N,R,Q,w)
As the string is quoted, this would attempt to reference a MuPAD Standard Library routine named "mtimes". There is no MuPAD Standard Library routine named "mtimes". "mtimes" is a MATLAB routine; MATLAB routines are inaccessible from within the MuPAD.
There is, as best I can see, no COEFF parameter for any of the overloaded MATLAB mtimes routines.
The Disload referred to in the "COEFF =" part of the expression attempts to refer to the variable Disload defined at the MATLAB level,
COEFF = [M ; N ; R ; Q ; w];
Variables defined at the MATLAB level do not exist at the MuPAD level. The MuPAD level and the MATLAB level are effectively two different workspaces, and the only explicit transportation across those workspaces is by way of the MATLAB subs() routine.
Likewise for A10 and the other matrices you define.
Remember: if you have a quoted string in a symbolic function call, then the string is interpreted in MuPAD. Use subs() to breach the barrier:
solve(subs('mtimes(A_10, COEFF_0) = W'), M,N,R,Q,q)
This would at least substitute in the MATLAB values for A_10 and COEFF_0, but it is still going to have problems with mtimes.
solve(mtimes(A_10, COEFF_0), M,N,R,Q,q)
Well, that would attempt to multiply A_10 by COEFF_0 and pass the result in to solve()... perhaps that would be useful. But I cannot see anything that might correspond to COEFF= as an argument to mtimes.
By the way: as documented in the tutorial, you need a blank line before a numbered or bullet list.
  댓글 수: 2
Steven
Steven 2011년 11월 8일
What I need is the solutions for M, N, R, Q & w in symbols of the matrix product
# A_10 x COEFF_0 = W
# A_11 x COEFF = Disload
# A_12 x COEFF = Disload
# A_13 x COEFF = Disload
# A_20 x COEFF_0 = W
# A_21 x COEFF = Disload
# A_22 x COEFF = Disload
# A_23 x COEFF = Disload
where A_10, A_11, A_12, etc., is a 5*5 matrix, COEFF, COEFF_0 and Disload is a 5*1 matrix. The problem looks more complicated then it is due to the large A matrix each time.
Trying
solve(subs('mtimes(A_10, COEFF_0) = W'), M,N,R,Q,q)
gives as error:
??? Error using ==> mupadmex
Error in MuPAD command: NEW arrays must be scalar or the same shape.
Error in ==> sym.subs>mupadsubs at 149
G = mupadmex('mllib::fullsubs',F.s,X2,Y2);
Error in ==> sym.subs at 125
G = mupadsubs(F,X,Y);
Error in ==> subs at 60
r = subs(sym(f),varargin{:});
Error in ==> coefficients_model at 45
solve(subs('mtimes(A_10, COEFF_0) = W'),M,N,R,Q,q)
Trying
solve(mtimes(A_10, COEFF_0), M,N,R,Q,q)
gives the following error
??? Error using ==> mupadmex
Error in MuPAD command: NEW arrays must be scalar or the same shape.
Error in ==> sym.subs>mupadsubs at 149
G = mupadmex('mllib::fullsubs',F.s,X2,Y2);
Walter Roberson
Walter Roberson 2011년 11월 8일
solve() of A*x = B is the same as solve() of A*x-B (implicit "=0") but does not have the difficulty of trying to slip a "=" between MATLAB and MuPAD.
Your quoted string version had the "=" in the wrong place. You had
solve('mtimes(A_23, COEFF = Disload)',M,N,R,Q,w)
when (if MuPad understood mtimes at all, and all the variables were already in the MuPAD workspace) it should have been
solve('mtimes(A_23, COEFF) = Disload',M,N,R,Q,w)
I do not know why
solve(mtimes(A_10, COEFF_0), M,N,R,Q,q)
gives that error; I have not encountered it before. I recommend trying
t = A_10 * COEFF_0
and then
solve(t - W, M, N, R, Q, q)
This will at least isolate whether the matter is in the mtimes() or in the solve()

댓글을 달려면 로그인하십시오.


William
William 2011년 11월 8일
My advice would be to break this up and try parts a piece at a time. You're going to drive yourself up the wall if you try and tackle the whole thing at the same time. Figure out which exact part is causing to problem and the try asking another question.
  댓글 수: 2
Steven
Steven 2011년 11월 8일
ok.. as I forgot to mention I get those two warnings for each line I used the solve command to solve the matrix multiplication, so at
solve('mtimes(A_10, COEFF_0) = W',M,N,R,Q,q)
solve('mtimes(A_11, COEFF = Disload)',M,N,R,Q,w)
solve('mtimes(A_12, COEFF = Disload)',M,N,R,Q,w)
etc,
If you split the file up into parts it would thus become:
(I first define 5x1 matrices with symbols in them, then I define the matrix A which is different for each case and is a 5x5 matrix, then I want to solve, in the first case, A_10 x COEFF_0 = W (matrix product)for the symbols M,N,R,Q,q.
syms M N R Q w K BETA GAMMA THETA M_1 M_2 M_0 q L E I Ec P;
COEFF_0 = [M ; N ; R ; Q ; q];
COEFF = [M ; N ; R ; Q ; w];
Disload = [-1/K ; 0 ; -1/K ; 0 ; -1/K];
W = [0 ; 0 ; 0 ; 0; 1];
%% CASE 1: Pin supported
%-----------------------
%P=0
A_10 = [1 0 1 0 1/K ; BETA*BETA-GAMMA*GAMMA 2*GAMMA*BETA BETA*BETA-GAMMA*GAMMA -2*GAMMA*BETA 0 ; exp(BETA*L)*cos(GAMMA*L) exp(BETA*L)*sin(M_1*L) exp(-BETA*L)*cos(GAMMA*L) exp(-BETA*L)*sin(GAMMA*L) 1/K ; exp(BETA*L)*((BETA*BETA-GAMMA*GAMMA)*cos(GAMMA*L)-2*GAMMA*BETA*sin(GAMMA*L)) exp(BETA*L)*(2*GAMMA*BETA*cos(GAMMA*L)+(BETA*BETA-GAMMA*GAMMA)*sin(GAMMA*L)) exp(-BETA*L)*((BETA*BETA-GAMMA*GAMMA)*cos(GAMMA*L)+2*GAMMA*BETA*sin(GAMMA*L)) exp(-BETA*L)*(-2*GAMMA*BETA*cos(GAMMA*L)+(BETA*BETA-GAMMA*GAMMA)*sin(GAMMA*L)) 0 ; exp(BETA*L/2)*cos(GAMMA*L/2) exp(BETA*L/2)*sin(GAMMA*L/2) exp(-BETA*L/2)*cos(GAMMA*L/2) exp(-BETA*L/2)*sin(GAMMA*L/2) 1/K];
solve('mtimes(A_10, COEFF_0) = W',M,N,R,Q,q)
Walter Roberson
Walter Roberson 2011년 11월 8일
This has all the same problems I described, except that it does not try to use "COEFF="

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by