3

You can calculate eigenvectors of a matrix with eig() function like this:

[eigenvectors, eigenvalues] = eig (matrix)

But I can't manage to understand why the eigenvector output is in some kind of unitary module format.

Example:

Matrix: $$\left(\begin{matrix} 2 & -4\\ -1 & -1\end{matrix}\right)$$

Eigenvalues output of the function: $$\left(\begin{matrix} 3 & 0\\ 0& -2\end{matrix}\right)$$

(I get it, -2 and 3 are the eigenvalues, they are in the main diagonal)

Eigenvectors output of the function: $$\left(\begin{matrix} 0.97014& 0.70711\\ -0.24254 & 0.70711\end{matrix}\right)$$ Why those values instead of the eigenvectors?: $$\left(\begin{matrix} -4\\ 1\end{matrix}\right)$$ and

$$\left(\begin{matrix} 1\\ 1\end{matrix}\right)$$

Chinny84
  • 14,371
user213028
  • 41
  • 1
  • 1
  • 3
  • If you want eigenvectors more along the lines of how a human would calculate them, you can try using symbolic math in Matlab: A=sym([2 -4;-1 -1]) [V,D]=eig(A). This uses sym/eig (documentation). – horchler Feb 04 '15 at 21:22
  • It seems Octave sym function has a different syntax, I downloaded the symbolic package but I get an error when trying to insert the matrix: warning: range error for conversion to character value warning: implicit conversion from matrix to sq_string – user213028 Feb 04 '15 at 21:54
  • Octave's symbolic math is well behind Matlab's. It may not support matrices. Or you may need to specify the matrix as a string, i.e., A=sym('[4,1;-1,-1]'), which is generally deprecated syntax in Matlab. In any case I recommend that you read Octave's documentation. – horchler Feb 05 '15 at 01:10
  • 1
    Also, while your question relates to Matlab programming, I think you have a case for asking that it be reopened. The accepted answer makes this clear. – horchler Feb 05 '15 at 01:12

1 Answers1

5

Eigenvectors are determined only up to a scaling by a constant multiplier. So for an eigenvector $(1,1)$, the vectors $(2,2)$ and $(0.5,0.5)$ are the same eigenvector. It looks like Matlab chooses to normalize the eigenvectors to unit norm. This normalization is the most commonly used.

Victor Liu
  • 3,771
  • Thank you, I'm new to algebra tools, if only I could get the output "more along the lines of how a human would calculate them" as horchler said... – user213028 Feb 04 '15 at 21:58
  • For that, you might be more interested in using Mathematica. For exactly represented matrices (integer or symbolic entries), it will return eigenvalues and eigenvectors in exact representations whenever possible. In this case, it usually normalizes one entry of the vector to 1, so it would return $(1,1)$ and $(-4,1)$, but possibly $(1,-\frac{1}{4})$. – Victor Liu Feb 04 '15 at 22:08
  • Thank you very much, I will try it. – user213028 Feb 04 '15 at 22:56
  • Mathematica will indeed return the whole number values – Valentin V Jan 12 '19 at 17:13