Azzera filtri
Azzera filtri

Second argument must be a vector of symbolic variables error

2 visualizzazioni (ultimi 30 giorni)
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 Commento
Torsten
Torsten il 15 Gen 2023
Modificato: Torsten il 15 Gen 2023
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 ?

Accedi per commentare.

Risposte (1)

Walter Roberson
Walter Roberson il 15 Gen 2023
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

Categorie

Scopri di più su Symbolic Math Toolbox in Help Center e File Exchange

Prodotti


Release

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by