MATLAB: Does EIG not return normalized eigenvectors when the input is a symbolic matrix in Symbolic Math Toolbox

Symbolic Math Toolbox

When EIG is called with a symbolic matrix it does not return the normalized eigenvectors.
For example, when I execute the following commands:
x= [1 2 3;1 2 3;1 2 3];
xsym =sym(x)
[a,b] = eig(x)
[c,d] = eig(xsym)
The columns of a are normalized eigenvectors (i.e. their norm is 1). This is not the case for the columns of c.

Best Answer

The function EIG is overloaded in the Symbolic Math toolbox. When the input argument to the function EIG is symbolic, it is this function that is being called. The documentation for this function can be accessed by typing
doc symbolic/eig
at the MATLAB command prompt. When you access the documentation for the EIG function in base MATLAB by typing
doc eig
at the MATLAB command prompt, a message is displayed stating this function is overloaded in the Symbolic Math Toolbox.
The algorithms used by the two EIG functions are not the same. In particular, the algorithm used by the symbolic EIG function is not designed to return the normalized eigenvectors.
If your symbolic matrix contains no symbolic variables and you wish to get normalized eigenvectors, you can use the VPA function in conjunction with the EIG function.
A = sym([2 1; 1 2])
[V,D] = eig(vpa(A))
Related Question