next up previous contents
Next: Sparse matrix computations Up: Advanced matrix computations Previous: Advanced matrix computations

Eigenvalues and other numerical linear algebra computations

In addition to solving linear systems (with the backslash operator), Matlab performs many other matrix computations. Among the most useful is the computation of eigenvalues and eigenvectors with the eig command. If A is a square matrix, then ev = eig(A) returns the eigenvalues of A in a vector, while [V,D] = eig(A) returns the spectral decomposition of A: V is a matrix whose columns are eigenvectors of A, while D is a diagonal matrix whose diagonal entries are eigenvalues. The equation AV = VD holds. If A is diagonalizable, then V is invertible, while if A is symmetric, then V is orthogonal ( tex2html_wrap_inline747 ).

Here is an example:

>> A = [1 3 2;4 5 6;7 8 9]
A =
     1     3     2
     4     5     6
     7     8     9
>> eig(A)
ans =
  15.9743          
  -0.4871 + 0.5711i
  -0.4871 - 0.5711i
>> [V,D] = eig(A)
V =
  -0.2155             0.0683 + 0.7215i   0.0683 - 0.7215i
  -0.5277            -0.3613 - 0.0027i  -0.3613 + 0.0027i
  -0.8216             0.2851 - 0.5129i   0.2851 + 0.5129i
D =
  15.9743                  0                  0          
        0            -0.4871 + 0.5711i        0          
        0                  0            -0.4871 - 0.5711i
>> A*V-V*D
ans =
   1.0e-14 *
  -0.0888             0.0777 - 0.1998i   0.0777 + 0.1998i
        0            -0.0583 + 0.0666i  -0.0583 - 0.0666i
        0            -0.0555 + 0.2387i  -0.0555 - 0.2387i

There are many other matrix functions in Matlab, many of them related to matrix factorizations. Some of the most useful are:



Mark S. Gockenbach
Wed Sep 8 10:44:13 EDT 1999