MATLAB编程求解方程组,写出程序
展开全部
syms x1 x2 x3
>> [A, b] = equationsToMatrix([3*x1-x2+2*x3==7, -x1+2*x2-2*x3==-1, 2*x1-2*x2+4*x3==0], [x1,x2,x3])
A =
[ 3, -1, 2]
[ -1, 2, -2]
[ 2, -2, 4]
b =
7
-1
0
>> s=A\b
s =
7/2
-1
-9/4
>> [A, b] = equationsToMatrix([3*x1-x2+2*x3==7, -x1+2*x2-2*x3==-1, 2*x1-2*x2+4*x3==0], [x1,x2,x3])
A =
[ 3, -1, 2]
[ -1, 2, -2]
[ 2, -2, 4]
b =
7
-1
0
>> s=A\b
s =
7/2
-1
-9/4
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |