MATLAB functions common matrix operation as follows:
Function name | Explanation |
the | Determinant Matrix |
inv | Matrix inversion |
eig | Find eigenvalues and eigenvectors |
rank | Matrix rank |
trace | Find trace of a matrix |
norm | Matrix norm |
poly | Matrix seeking roots of the characteristic equation |
fliplr | Flip a matrix about |
flipud | Matrix upside down |
resharp | Matrix order restructuring |
rot90 | Matrix rotated counterclockwise 90 degrees |
diag | Extracting or creating a diagonal matrix |
Trill | A lower left triangular portion of the matrix is taken |
affectionate | The upper-right triangular matrix portion taken |
Example 1: Find the eigenvalues and eigenvectors
A = >> [ . 1 , 2 ; 2 , . 4 ] [X, y] = EIG (A)% X is the eigenvector matrix, y is the eigenvalue matrix A = . 1 2 2 . 4 X = - 2584 / 2889 1292 / 2889 1292 / 2889 2584 / 2889 Y = 0 0 0 . 5
Example 2: Inverse of Matrix
>> A = rand(3) A = 979/1292 1406/2145 128/4021 541/728 1193/6969 18/65 1645/4194 1016/1439 243/5263 >> B = inv(A) B = 1063/447 457/4629 -1676/751 -1603/1702 -784/2749 682/289 -2053/354 2899/823 3547/783
Example 3: norm of Matrix
>> A = randn(3) A = -1004/341 -1685/2232 -269/2631 817/568 2113/1542 -861/3566 213/655 -1501/877 354/1109 >> B = norm(A) B = 8065/2266
2.4.1 matrix decomposition operation
Decomposition is used for solving the matrix equations line
Function name | Explanation |
eig | Eigenvalue Decomposition |
SVD | Singular Value Decomposition |
lu | LU decomposition |
chol | Cholesky decomposition |
qr | QR decomposition |
schur | Schur decomposition |
>> A = rand(5) [u,s,v] = svd(A) %A = u*s*v A = 302/461 547/1607 637/1259 131/945 13088/16073 655/4028 580/991 1287/1841 222/1487 771/3166 1078/9059 438/1957 2752/3089 463/1798 959/1032 457 / 917 1927 / 2565 542 / 565 797 / 948 1079 / 3083 1049 / 1093 388 / 1521 226 / 413 193 / 759 358 / 1821 in = - 529 / 1228 - 661 / 3882 - 974 / 1699 523 / 5293 - 577 / 863 -400/1173 -169/5333 1242/3467 790/911 413/8467 -1167/2552 -227/314 -277/11168 -501/2254 377/807 -751/1287 317/977 848/1531 -658/1521 -616/2509 -728/1889 875/1496 -133/274 287/6999 1255/2406 s = 4672/1803 0 0 0 0 0 1172/1401 0 0 0 0 0 821/1077 0 0 0 0 0 461/1387 0 0 0 0 0 427/1809 v = -492/1211 594/955 -726/1085 157/17100 83/5177 -573/1507 6583/35608 66/167 1233/2317 -351/568 -398/631 -460/3179 547/2044 313/1585 863/1258 -390/1237 512/2069 954/2347 -773/961 -461/2799 -951/2164 -1330/1887 -757/1897 -747/4262 -679/1959
2.4.2 Relations with the arithmetic logic operation
- Given true and false propositions
- MATLAB any non-zero values are as true and 0 when the fraud
- True output 1, false 0