# Calculating Eigenvalues And Eigenvectors Of Matrices In MatLab®(Illustrated Expression)

Eigenvalues and eigenvectors are generally used in lots of engineering areas. It is very hard to calculate eigenvectors and eigenvalues by hand compared to solving with Matlab®. Matlab® has a special command to do it. In this article, we will show you how to calculate Eigenvalues and Eigenvectors of a matrix in Matlab®.

## How To Calculate Eigenvalues And Eigenvectors In Matlab®?

``````>> a = [1 3 2; 6 5 4; 7 8 9]
eig(a)
[A, B] = eig(a)

a =

1     3     2
6     5     4
7     8     9

ans =

15.1601
-1.6860
1.5258

A =

-0.2199   -0.7374   -0.2033
-0.4671    0.6751   -0.5675
-0.8564   -0.0224    0.7979

B =

15.1601         0         0
0   -1.6860         0
0         0    1.5258

>> ``````

We created a matrix ‘a’ shown above to show you how to calculate the eigenvalues and eigenvector of it. Eigenvector and eigenvalues are calculated with codes like in the green box in Matlab®.

If we take a look at the results, the eigenvalue of the matrix ‘a’ is directly calculated in Matlab® with eig() command.

Also, we calculated the eigenvectors of matrix ‘a’ in the form of variables ‘A’ and ‘B’. We assigned these variables in the eig() code for eigenvector results as shown above in Matlab® command window.

‘B’ matrix includes eigenvectors of matrix ‘a’ at its diagonal values, and ‘A’ also includes the whole eigenvectors of the matrix ‘a’ in it.

## Conclusion

So it is very basic to calculate the Eigenvectors and Eigenvalues of a matrix in Matlab®.

Leave your comments and questions below!

If you want further coding examples about the ‘eig()’ command in Matlab®, inform us in the comments.

This article is prepared for completely educative and informative purposes. Images used courtesy of Matlab®

Your precious feedbacks are very important to us.