- Determinant of a Square Matrix:
MatLab function det(A) computes the determinant of
matrix A. For example,
>> A=[1 2 0 4;3 -1 1 2;0 2 0 -1;1 2 3 4];
>> det(A)
ans = -81
Type >>help det to learn more about this function.
- Inverse of a Nonsingular Matrix:
MatLab function inv(A) computes the inverse of
a nonsingular matrix A.
Since the determinant of matrix A given in 1. is not zero,
A-1 exists. Let us find A-1 now.
>> A=[1 2 0 4;3 -1 1 2;0 2 0 -1;1 2 3 4];
>> B=inv(A)
B =
0.0123 0.3704 0.2963 -0.1235
0.0988 -0.0370 0.3704 0.0123
-0.3333 0 0 0.3333
0.1975 -0.0741 -0.2593 0.0247
Type >>help inv to learn more about this function.
- Eigenvalues and Eigenvectors of a Square Matrix:
MatLab function eig(A) computes all eigenvalues and
their corresponding eigenvectors of a square matrix A. Command
E=eig(A) gives a vector containing all eigenvalues of a square
matrix A. Command [V,D]=eig(A) produces a diagonal matrix D
whose diagonal elements are eigenvalues of A
and a full matrix V whose columns are the corresponding eigenvectors so
that A*V = V*D. Now let us find all eigenvalues and eigenvectors of
the matrix A given in 1.
>> A=[1 2 0 4;3 -1 1 2;0 2 0 -1;1 2 3 4];
>> E=eig(A)
E =
6.4652
-3.1268
0.3308 + 1.9742i
0.3308 - 1.9742i
>> [V,D]=eig(A)
V =
-0.6300 -0.4162 -0.4100 + 0.3725i -0.4100 - 0.3725i
-0.4306 0.7714 -0.0698 + 0.3657i -0.0698 - 0.3657i
-0.0334 -0.4794 0.5760 + 0.1265i 0.5760 - 0.1265i
-0.6455 0.0437 -0.0803 - 0.4475i -0.0803 + 0.4475i
D =
6.4652 0 0 0
0 -3.1268 0 0
0 0 0.3308 + 1.9742i 0
0 0 0 0.3308 - 1.9742i
Type >>help eig to learn more about this function.