How to find eigenvalues in matlab?
Methods for finding the eigenvalues and eigenvectors of a matrix
Methods/steps
In the first step, we first need to know what is used to calculate the eigenvalues and eigenvectors of a matrix eig function, you can enter help eig in the command line window to check the usage of the eig function, as shown in the following figure:
The second step is to enter a in the command line window =[1 2 3;2 4 5;7 8 9], after pressing the Enter key, enter [x,y]=eig(a), as shown in the following figure:
In the third step, after pressing the Enter key, the values of x and y are obtained. Each column value of x represents an eigenvector of the matrix a. There are 3 eigenvectors here. The diagonal element value of y represents the matrix a. The eigenvalues of , as shown in the figure below:
Step 4 If we want to take the diagonal element value of y, we can use diag(y), as shown in the figure below:
In the fifth step, after pressing the Enter key, you can see that the diagonal element value of y has been taken out, which is the eigenvalue of the a matrix, as shown in the following figure:
In the sixth step, we can also help diag in the command line window, and you can see the usage of the diag function, as shown in the following figure:
For more programming-related content, please pay attention to theProgramming Introductioncolumn on the php Chinese website!
The above is the detailed content of How to find eigenvalues in matlab. For more information, please follow other related articles on the PHP Chinese website!