Explicit solution could not be found error
1 次查看(过去 30 天)
显示 更早的评论
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:
- Warning: 1 equations in 5 variables. New variables might be introduced.
- 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)
0 个评论
回答(2 个)
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.
2 个评论
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
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 个评论
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!