# Sym: The second argument must be a vector of symbolic variables

55 ビュー (過去 30 日間)
Alejandro Buenrostro 2019 年 12 月 8 日

I do not understand the error this is my code
clear all; %#ok<CLALL>
clc;
syms w1 w2 r1 r2 vc vR1 vR2 mc mR1 mR2 IgR1 IgR2 t z IB IA x vc M y
eqn1=vR1-vc==0;
eqn2=vR1-vR2==0;
eqn3=w1*r1-w2*r2==0;
eqn4=(IgR1+mR1*(r1^2))*w1*r1+mc*w1*r1*x+(3/2)*mR2*(r2^2)*((w1*r1)/r2)-M*t==0;
eqn5=y/t-vc==0;
eqn6=y-3==0;
eqn7=t-3==0;
eqn8=r1-0.03==0;
eqn9=r2-0.005==0;
eqn10=z-0.18==0;
eqn11=mR1-0.008==0;
eqn12=mR2-0.002==0;
eqn13=(1/2)*mR1*(r1^2)-IgR1==0;
eqn14=x-0.05==0;
eqn15=mc-0.05==0;
sol = solve([eqn1, eqn2, eqn3, eqn4, eqn5, eqn6, eqn7, eqn8, eqn9, eqn10, eqn11, eqn12, eqn13, eqn14, eqn15], [w1, w2, r1, r2, vc, vR1, vR2, mc, mR1, mR2, IgR1, IgR2, t, z, IB, IA, x, vc, M, y]);
w1Sol = sol.w1
w2Sol = sol.w2 %#ok<*NOPTS>
MSol = sol.M
this are the results
Error using sym.getEqnsVars>checkVariables (line
87)
Second argument must be a vector of symbolic
variables.
Error in sym.getEqnsVars (line 54)
checkVariables(vars);
Error in solve>getEqns (line 429)
[eqns, vars] = sym.getEqnsVars(argv{:});
Error in solve (line 226)
[eqns,vars,options] = getEqns(varargin{:});
Error in PruebaFinal (line 19)
sol = solve([eqn1, eqn2, eqn3, eqn4, eqn5, eqn6,
eqn7, eqn8, eqn9, eqn10, eqn11, eqn12, eqn13,
eqn14, eqn15], [w1, w2, r1, r2, vc, vR1, vR2,
mc, mR1, mR2, IgR1, IgR2, t, z, IB, IA, x, vc,
M, y]);
>>

#### 0 件のコメント

サインイン to comment.

### 回答 (1 件)

Shashank Gupta 2019 年 12 月 11 日
Hi Alejandro,
This error generally arises when a multiple array or a vector of equation is passed in “Solve” function. You can either pass individual equation as separate arguments or you can pass an array or vector of equation, but you cannot do both and not even giving them as a matrix equation supported.
I hope it helps you.

#### 0 件のコメント

サインイン to comment.

サインイン してこの質問に回答します。

R2019a

Translated by