matlab 解符号方程组S1 = 'x^2 + a*x + b*x + 1';S2 = 'x^2 + 3*b*x + 2*a*x';S11 = diff(S1,'x',1);S21 = diff(S2,'x',1);S22 = 'x-c';[x,a,b] = solve(S22,S21,S11)我希望得到的结果是x = c ; a = -4c ; b = 2c 但是结果却是x =-a/2a =-a/4b =-a
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/23 01:58:59
matlab 解符号方程组S1 = 'x^2 + a*x + b*x + 1';S2 = 'x^2 + 3*b*x + 2*a*x';S11 = diff(S1,'x',1);S21 = diff(S2,'x',1);S22 = 'x-c';[x,a,b] = solve(S22,S21,S11)我希望得到的结果是x = c ; a = -4c ; b = 2c 但是结果却是x =-a/2a =-a/4b =-a
matlab 解符号方程组
S1 = 'x^2 + a*x + b*x + 1';
S2 = 'x^2 + 3*b*x + 2*a*x';
S11 = diff(S1,'x',1);
S21 = diff(S2,'x',1);
S22 = 'x-c';
[x,a,b] = solve(S22,S21,S11)
我希望得到的结果是x = c ; a = -4c ; b = 2c
但是结果却是
x =-a/2
a =-a/4
b =-a/4
这事为啥?
matlab 解符号方程组S1 = 'x^2 + a*x + b*x + 1';S2 = 'x^2 + 3*b*x + 2*a*x';S11 = diff(S1,'x',1);S21 = diff(S2,'x',1);S22 = 'x-c';[x,a,b] = solve(S22,S21,S11)我希望得到的结果是x = c ; a = -4c ; b = 2c 但是结果却是x =-a/2a =-a/4b =-a
你只要把这句
[x,a,b] = solve(S22,S21,S11)
改为
[x,a,b] = solve(S22,S21,S11,'x,a,b')
就可以了,加的东西就是说明,x,a,b是未知数,剩下的c就是当已知数了.
[x,a,b] = solve(S22,S21,S11,'x,a,b')
x =
-4*c
a =
2*c
b =
c