find the eigenvalues of a matrix in matlab

To find the eigenvalues of a matrix in Matlab, you can use the eig function. The syntax for this function is as follows:

main.m
e = eig(A)
11 chars
2 lines

where A is the matrix whose eigenvalues you want to calculate, and e is a column vector containing the eigenvalues of A.

Here's an example:

main.m
A = [1 2; 3 4];
e = eig(A);
disp(e);
37 chars
4 lines

This will output:

main.m
-0.3723
5.3723
15 chars
3 lines

This tells us that the eigenvalues of the matrix A are approximately -0.3723 and 5.3723.

gistlibby LogSnag