MATLAB中的SOLVE函数不但能解直接求解,还能求解带参数的方程:
clear all
syms R X a b c d x1 x2 x3 x4;
[x1,x2,x3,x4]=solve('R*x1+R*x3-X*x4=a','R*x2+X*x3+R*x4=b','R*x1-X*x2+R*x3=c','X*x1+R*x2+R*x4=d','x1,x2,x3,x4')
我运行了一下结果如下:x1 =
(2*R^2*d-2*R^2*b+R*X*c+R*a*X+X^2*d)/X/(4*R^2+X^2)
x2 =
(-2*R^2*c+X*R*d+R*X*b-X^2*c+2*R^2*a)/X/(4*R^2+X^2)
x3 =
1/X*(-2*R^2*d+2*R^2*b+R*X*c+X^2*b+R*a*X)/(4*R^2+X^2)
x4 =
-(-2*R^2*c-X*R*d-R*X*b+2*R^2*a+X^2*a)/X/(4*R^2+X^2)
>>