【发布时间】:2021-10-22 08:25:03
【问题描述】:
我有矩阵方程,我需要求解方程以获得这些向量的值,当我使用函数求解时,它给我的错误如下: 使用 sym.getEqnsVars>checkVariables 时出错(第 92 行) 第二个参数必须是符号变量的向量。
Error in sym.getEqnsVars (line 56)
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{:});
这是我正在使用的代码:
clear all; clc;
w2 = rand(2,2);
w3 = rand(2,2);
F2 = rand(2,2);
w5 = rand(2,2);
w6 = rand(2,2);
F5 = rand(2,2);
w8 = rand(2,2);
w9 = rand(2,2);
F8 = rand(2,2);
y1 = rand(2,1);
y2 = rand(2,1);
y3 = rand(2,1);
syms x2 x3 s2
solve(-w2*x2 - w3*x3 + F2*s2 == y1, -w5*x2 - w6*x3 + F5*s2 == y2, -w8*x2 - w9*x3 + F8*s2 == y3);
【问题讨论】: