필터 지우기
필터 지우기

Second argument must be a vector of symbolic variables error

조회 수: 2 (최근 30일)
Imanol Fernandez de arroyabe Zabala
편집: Torsten 2023년 1월 15일
When trying to solve this equation system I get the error stated in the title
syms l1 l2 l3 H B phi gamma theta omega1 omega2 omega3 t
l1 = 0.12;
l2 = 0.29;
l3 = 0.157;
H = 0.15;
B = 0.238;
theta = (pi/900)*t;
eq3 = l1*cos(theta) + l2*cos(phi) - l3*sin(gamma) - H == 0
eq3 = 
eq4 = B + l1*sin(theta) - l2*sin(phi) - l3*cos(gamma) == 0
eq4 = 
sol1 = solve([eq3, eq4], [phi, gamma])
sol1 = struct with fields:
phi: [2×1 sym] gamma: [2×1 sym]
syms omega1 omega2 omega3 vA vB vC
omega1_v = [0 0 omega1]
omega1_v = 
omega2_v = [0 0 omega2]
omega2_v = 
omega3_v = [0 0 omega3]
omega3_v = 
AB = [l1*cos(theta) l1*sin(theta) 0]
AB = 
BC = [l2*cos(phi) l2*sin(phi) 0]
BC = 
CD = [l2*cos(gamma) l2*sin(gamma) 0]
CD = 
eq5 = vB == cross(omega1_v, AB)
eq5 = 
eq6 = vC == vB + cross(omega2_v, BC)
eq6 = 
eq7 = 0 == vC + cross(omega3_v, CD)
eq7 = 
sol2 = solve([eq5, eq6, eq7], [omega1_v, omega2_v, omega3_v])
Error using sym.getEqnsVars>checkVariables
Second argument must be a vector of symbolic variables.

Error in sym.getEqnsVars (line 62)
checkVariables(vars);

Error in sym/solve>getEqns (line 429)
[eqns, vars] = sym.getEqnsVars(argv{:});

Error in sym/solve (line 226)
[eqns,vars,options] = getEqns(varargin{:});
How can I solve this?
  댓글 수: 1
Torsten
Torsten 2023년 1월 15일
편집: Torsten 2023년 1월 15일
Don't you see after printing out the equations that your solve command makes no sense ?
You say that at the same time, vB and vC should be equal to three different values. How should this work ?

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

답변 (1개)

Walter Roberson
Walter Roberson 2023년 1월 15일
omega1_v = [0 0 omega1]
That is a vector that includes numeric values. You cannot solve for a numeric value. You should be asking to solve for omega1 not for omega1_v

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by