MATLAB: How to find number of linearly independent eigenvectors in a matrix
eigenvectorsmatrices
I have a matrix
0 -1 -2 -1
-1 0 -1 0
-2 -1 0 -1
-1 0 -1 0
Each column represent an eigen vector, In the above case I have three linearly independent eigenvectors , How can I find this in matlab ?
Best Answer
In the context of Linear Algebra, one finds an eigenvalue of a matrix and then finds the right or the left eigenvector associated to that eigenvalue. Assume you have the matrix (your matrix)
A =
0 -1 -2 -1
-1 0 -1 0
-2 -1 0 -1
-1 0 -1 0
In order to have an idea of how many linearly independent columns (or rows) that matrix has, which is equivalent to finding the rank of the matrix, you find the eigenvalues first. And then you can talk about the eigenvectors of those eigenvalues.
Hence, if I understand it correctly, you're trying to find the rank of the matrix.
Following gives the number of linearly independent columns (or rows) of matrix A
>> rank(A)
ans =
3
And following outputs the eigenvalues (and their right eigenvectors) of that matrix
Most of the time functions don't operate "externally", so SORTROWS doesn't alter your arrayP defined in the workspace. It creates a new sorted array that it outputs. You have to store this output back intoP if you wantP to be the sorted version. If you wanted to keep the original, you could store it into a new variable:
Best Answer