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

你可能感兴趣的:(Octave 线性代数 矩阵 1)