資源描述:
《第四講 矩 陣運(yùn)算》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫。
1、第四講矩陣運(yùn)算【目錄】一、矩陣運(yùn)算2(1)概述2(2)矩陣的加減法2(3)矢量積與轉(zhuǎn)置3(4)復(fù)數(shù)的共軛與轉(zhuǎn)置3(5)矩陣的乘法4(6)矩陣的除法5(7)矩陣的乘冪6(8)解線性方程6【正文】一、矩陣運(yùn)算(1)概述矩陣與數(shù)組在數(shù)據(jù)形式上是一致的,但在運(yùn)算上是有區(qū)別的。Matlab的線性工具箱在目錄matfun中。幾個(gè)常用的函數(shù):norm-矩陣的范數(shù)rank-矩陣的秩det-方陣的行列式的值inv-逆矩陣(2)矩陣的加減法大小相等的矩陣才能加減:【例】A=pascal(3)B=magic(3)C=A+BD=A-BA=11112313
2、6B=816357492C=92747105128D=-70-5-2-3-4-3-64(3)矢量積與轉(zhuǎn)置【例】A=[1,2,3]%行向量B=[3;5;9]%列向量C=A*B%點(diǎn)積D=B*A%叉積E=D'%D的轉(zhuǎn)置A=123B=359C=40D=3695101591827E=3596101891527(4)復(fù)數(shù)的共軛與轉(zhuǎn)置若A為復(fù)數(shù)矩陣,則A'表示A的共軛,A.'表示轉(zhuǎn)置?!纠緼=[3+2i,5+3i;2+8i,9+5i]B=A'%表示共軛B=A.'%表示轉(zhuǎn)置A=3.0000+2.0000i5.0000+3.0000i2.0000
3、+8.0000i9.0000+5.0000iB=3.0000-2.0000i2.0000-8.0000i5.0000-3.0000i9.0000-5.0000iB=3.0000+2.0000i2.0000+8.0000i5.0000+3.0000i9.0000+5.0000i(5)矩陣的乘法【例】A=[1,2,3;3,5,6;2,3,1]%定義兩個(gè)3×3的矩陣B=[5,2,8;9,6,3;2,5,6]C=A*B%矩陣的乘積:(C≠D)D=B*AE=A.*B%數(shù)組的相乘:(E=F)F=B.*AA=Columns1through212
4、3523Column3361B=Columns1through2529625Column3836C=Columns1through2292972663927Column3327531D=Columns1through2274433572947Column3356642E=Columns1through2542730415Column324186F=Columns1through2542730415Column324186(6)矩陣的除法【例】A=[1,2,3;3,5,6;2,3,1]%定義兩個(gè)3×3的矩陣B=[5,2,8;9,6,
5、3;2,5,6]C=A/B%矩陣的除法D=A*B^(-1)E=A*inv(B)F=A./B%數(shù)組的除法A=123356231B=528963256C=0.0879-0.02560.39560.07690.10260.8462-0.25270.28210.3626D=0.0879-0.02560.39560.07690.10260.8462-0.25270.28210.3626E=0.0879-0.02560.39560.07690.10260.8462-0.25270.28210.3626F=0.20001.00000.37500
6、.33330.83332.00001.00000.60000.1667(7)矩陣的乘冪A=[1,2,3;3,5,6;2,3,1]%定義1個(gè)3×3的矩陣C=A^3%矩陣的乘冪D=A*A*AE=A^(-0.1)F=A.^3%數(shù)組的乘冪A=123356231C=112185183267440429129211196D=112185183267440429129211196E=Columns1through21.0860-0.3139i-0.1373+0.1088i-0.1790+0.1506i0.9192-0.1466i0.0065+0
7、.0417i-0.0352+0.0835iColumn30.0368+0.0499i-0.0883+0.1753i0.8702-0.2132iF=1827271252168271(8)解線性方程若:AX=B-解為X=B\A;若:XA=B-解為X=B/A。【例】A=[234;541;132]B=[1;2;3]X=ABA=234541132B=123X=-0.81481.6667-0.5926【例】A=[234;541;132]%B=[475;147;526]B=2*AX=ABA=Columns1through2235413Col
8、umn3412B=Columns1through24610826Column3824X=Column12.000000Column20.00002.0000-0.0000Column3002.0000