Octave 線性代數 矩陣 1


矩陣的轉置

矩陣后面加’

>> A = [1 0;-1 2;2 3]
A =

1 0
-1 2
2 3

>> B = [1 -1;4 7]
B =

1 -1
4 7

>> (A*B)'
ans =

1 7 14
-1 15 19

>> B'*A'
ans =

1 7 14
-1 15 19

>>

逆矩陣

inv(A)

>> A = [1 0 0;0 2 0;0 0 -3]
A =

1 0 0
0 2 0
0 0 -3

>> inv(A)
ans =

1.00000 -0.00000 0.00000
0.00000 0.50000 0.00000
0.00000 0.00000 -0.33333

初等變換

數乘 i 行 ri(k)

A(i,:) = k*A(i,:)

數乘 i 行加到 j 行 rij(k)

A(j,:) = k*A(i,:) + A(j,:)

交換i j行 r(ij

A = A([按i j交換好了的順序],:)

!!!列相反

e.g:對A進行變化成I|O 形式

>> A = [2 1 -4;1 -2 3]
A =

2 1 -4
1 -2 3

>> A = A([2 1],:)
A =

1 -2 3
2 1 -4

>> A(2,:) = -2 * A(1,:) + A(2,:)
A =

1 -2 3
0 5 -10

>> A(2,:) = 1/5 * A(2,:)
A =

1 -2 3
0 1 -2

>> A(1,:) = 2 * A(2,:) + A(1,:)
A =

1 0 -1
0 1 -2

>> A(:,3) = A(:,1) + A(:,3)
A =

1 0 0
0 1 -2

>> A(:,3) = 2 * A(:,2) + A(:,3)
A =

1 0 0
0 1 0

注意!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。



 
  © 2014-2022 ITdaan.com 联系我们: