@sym
: Lambda =
eig (A)
¶@sym
: [V, D] =
eig (A)
¶Symbolic eigenvalues/eigenvectors of a matrix.
Example:
A = sym([2 4; 6 8]); sort(eig(A)) ⇒ ans = (sym 2×1 matrix) ⎡5 - √33⎤ ⎢ ⎥ ⎣5 + √33⎦
We can also compute the eigenvectors:
[V, D] = eig(A) ⇒ V = (sym 2×2 matrix) ⎡ √33 1 1 √33⎤ ⎢- ─── - ─ - ─ + ───⎥ ⎢ 6 2 2 6 ⎥ ⎢ ⎥ ⎣ 1 1 ⎦ ⇒ D = (sym 2×2 matrix) ⎡5 - √33 0 ⎤ ⎢ ⎥ ⎣ 0 5 + √33⎦
The eigenvectors are the columns of V; we can extract one and check:
v = V(:, 1) ⇒ v = (sym 2×1 matrix) ⎡ √33 1⎤ ⎢- ─── - ─⎥ ⎢ 6 2⎥ ⎢ ⎥ ⎣ 1 ⎦ lambda = D(1,1) ⇒ lambda = (sym) 5 - √33
simplify(A*v - lambda*v) ⇒ ans = (sym 2×1 matrix) ⎡0⎤ ⎢ ⎥ ⎣0⎦
Note: the generalized eigenvalue problem is not yet supported.
See also: @sym/svd.
Package: symbolic