Matrix manipulation Flashcards
Define matrix A
| 1 2 |
| 3 4 |
| 5 6 |
A = [1 2; 3 4; 5 6]
Identity matrix of size 3
eye(3)
"Vectorize" elements of a matrix A: | 1 2 | | 3 4 | to |1| |2| |3| |4|
A(:)
Transpose matrix A
A’
Exact inverse of a square martix A
inv(A)
Generalized inverse of matrix A. Properties?
pinv(A)
A may be square or non square or singular. Pseudo-inverse solves for best fit of a solution to inverse problem.
Element ‘3’ of matrix A:
| 1 2 |
| 3 4 |
| 5 6 |
A(2,1)
Element ‘6’ of matrix A:
| 1 2 |
| 3 4 |
| 5 6 |
A(3,2)
First column of matrix A:
| 1 2 |
| 3 4 |
| 5 6 |
A(:,1)
Second row of matrix A:
| 1 2 |
| 3 4 |
| 5 6 |
A(2,:)
First and third row of matrix A:
| 1 2 |
| 3 4 |
| 5 6 |
A( [1 3], : )
Copy 3rd row to 1st row of matrix A:
| 1 2 |
| 3 4 |
| 5 6 |
A( 1, : ) = A ( 3, : )
Retrieve number of rows of matrix A.
size(A, 1)
Retrieve number of columns of matrix A.
size(A, 2)
Retrieve greater dimension of matrix A.
length(A)