程序如下:
clear;clc;
eq1 = sym('x-z-a');
eq2 = sym('x-u-b');
eq3 = sym('x+y+v-c');
eq4 = sym('x+z-d');
eq5 = sym('x-y+v-e');
eq6 = sym('x+u-f');
[x y z u v w] = solve(eq1,eq2,eq3,eq4,eq5,eq6)
结果如下,代入方程运算检验是错误的:
x =
a+d-b
y =
1/2*a-b+1/2*d
z =
-1/2*a+1/2*e-1/2*d+1/2*c
u =
1/2*a+1/2*d
v =
-1/2*e+1/2*c
w =
-1/2*a+1/2*d
原来出问题是因为6个方程只有五个待求未知量,导致无法找到解法,我引入了一个t现在问题解决了
clear;clc;
eq1 = sym('x-z-a');
eq2 = sym('x-u-b');
eq3 = sym('x+y+v-c');
eq4 = sym('x+z-d');
eq5 = sym('x-y+v-e');
eq6 = sym('x+u-f');
syms t
D= solve(eq1,eq2,eq3,eq4,eq5,eq6,'x,y,z,u,v,t')