power iteration finds the dominant eigenvector, i.e. eigenvector with the largest eigenvalue.
if you start with
v=ones(165,1)/165; % initialisation for i=1:5 % 5 iterations w=data_table*v; % assuming size(data_table) = [165 165] v=w/norm(w); end
and your algorithm converges in 5 iterations, then v is your dominant eigenvector;
Also, I would start with a smaller example to test your code. Your call matlab [U,V] = eig(data_matrix);
confused because V must be a diagonal matrix of size [165 165], and not a full matrix of size [3 3];
Try the following:
X=[1 1 1;1 1 2;1 2 2] [U,V]=eig(X) X*U(:,3) U(:,3)*V(3,3)
to see what is the largest eigenvalue in the output of the matrix, i.e. (V3,3) and the corresponding vector U (:, 3).
You can use power iteration to search for this eigenvector:
v=ones(1,3) w=v*X;v=w/norm(w) w=v*X;v=w/norm(w) w=v*X;v=w/norm(w) w=v*X;v=w/norm(w)
source share