to develop a MATLAB program for eigenvalue solving using MATRIX ITERATION method
I am trying to create a program which will compute eigenvalue using matrix iteration method. I just know some basic commands and still learning. I have created the following function but I know it has a lot of errors and is not complete. Can anyone plz help
function l = ww(m,k)
for i=1:1000
for j=1:1000
m = [i 0 0;0 2*i 0;0 0 i];
k = [2*j -j 0;-j 7*j -4*j;0 -4*j 5*j];
end
end
n = length(m);
y = [];
x = [];
for i = 1:n % starting vector
x(i) = m(i,1);
end;
l = 0;
blad = k; % starting value of error
while blad>=k
for i = 1:n % A*x
y(i) = 0;
for j = 1:n
y(i) = y(i) + m(i,j)*x(j);
end;
end;
blad = l;
l = 0; % Rayleigh
t = 0;
for i = 1:n
l = l + x(i)*y(i);
t = t + t(i)*x(i);
end;
l = l/t; % eigenvalue
blad = abs(l – blad); % error
x = y;
end;
endI am trying to create a program which will compute eigenvalue using matrix iteration method. I just know some basic commands and still learning. I have created the following function but I know it has a lot of errors and is not complete. Can anyone plz help
function l = ww(m,k)
for i=1:1000
for j=1:1000
m = [i 0 0;0 2*i 0;0 0 i];
k = [2*j -j 0;-j 7*j -4*j;0 -4*j 5*j];
end
end
n = length(m);
y = [];
x = [];
for i = 1:n % starting vector
x(i) = m(i,1);
end;
l = 0;
blad = k; % starting value of error
while blad>=k
for i = 1:n % A*x
y(i) = 0;
for j = 1:n
y(i) = y(i) + m(i,j)*x(j);
end;
end;
blad = l;
l = 0; % Rayleigh
t = 0;
for i = 1:n
l = l + x(i)*y(i);
t = t + t(i)*x(i);
end;
l = l/t; % eigenvalue
blad = abs(l – blad); % error
x = y;
end;
end I am trying to create a program which will compute eigenvalue using matrix iteration method. I just know some basic commands and still learning. I have created the following function but I know it has a lot of errors and is not complete. Can anyone plz help
function l = ww(m,k)
for i=1:1000
for j=1:1000
m = [i 0 0;0 2*i 0;0 0 i];
k = [2*j -j 0;-j 7*j -4*j;0 -4*j 5*j];
end
end
n = length(m);
y = [];
x = [];
for i = 1:n % starting vector
x(i) = m(i,1);
end;
l = 0;
blad = k; % starting value of error
while blad>=k
for i = 1:n % A*x
y(i) = 0;
for j = 1:n
y(i) = y(i) + m(i,j)*x(j);
end;
end;
blad = l;
l = 0; % Rayleigh
t = 0;
for i = 1:n
l = l + x(i)*y(i);
t = t + t(i)*x(i);
end;
l = l/t; % eigenvalue
blad = abs(l – blad); % error
x = y;
end;
end matrix iteration, eigenvalue MATLAB Answers — New Questions