【Matlab】求解多元一次方程组

  • Post author:
  • Post category:其他




符号运算:

syms a b c d e p m
 [a,b,c,d,e,p,m]=solve('a+b+c+d+e=0',
 'b+2*c+3*d+4*e-1-p-m=0',
'b+4*c+9*d+16*e-2*p-4*m=0',
'b+8*c+27*d+64*e-3*p-12*m=0',
'b+16*c+81*d+256*e-4*p-32*m=0',
'b+32*c+243*d+1024*e-5*p-80*m=0',
'b+64*c+729*d+4096*e-6*p-192*m=0')


%==========输出结果===========
a =
 
-43/12
 
 
b =
 
-20/3
 
 
c =
 
9
 
 
d =
 
4/3
 
 
e =
 
-1/12
 
 
p =
 
6
 
 
m =
 
8
 



矩阵运算:

 A=[1,1,1,1,1,0,0;
 0,1,2,3,4,-1,-1;
 0,1,4,9,16,-2,-4;
 0,1,8,27,64,-3,-12;
 0,1,16,81,256,-4,-32;
 0,1,32,243,1024,-5,-80;
 0,1,64,729,4096,-6,-192]; 
 
 B=[0;1;0;0;0;0;0]; 
 
 Z=A\B   
  %============输出结果===============
Z =-3.5833
   -6.6667
    9.0000
    1.3333
   -0.0833
    8.0000
    6.0000



版权声明:本文为lin970113原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。