Inverse Power Method Doesnt Work
8 views (last 30 days)
Show older comments
I try to find the smallest eigenvalue of a matrix using the Power Method to approximate its conditional number but it doesnt work. I can find the biggest eigenvector but not the smallest.
function [dk1,dkinf]=fun(x)
n = numel(x)-1;
psi = @(x)exp(-3*x.^2);
L = zeros(n+1);
for i = 1:n+1
L(i,:) = psi(x(1:n+1)-x(i));
end
format long
L
antL=inv(L)
A=max(sum(abs(L)))
B=max(sum(abs(antL)))
dk1=A*B
C=max(sum(abs(L')))
D=max(sum(abs(antL')))
dkinf=C*D
xold = 0.5*ones(n+1,1);
t=7
for i = 1:t
xnew=L*xold;
X=xnew/norm(xnew,2);
xold=xnew;
end
trX=transpose(X);
lmax=(trX*L*X)/(trX*X)
max(eig(L))
xold3 = 0.5*ones(n+1,1);
s=4
for i = 1:s
xnew2=L\xold3;
antX=xnew2/norm(xnew2,2);
xold3=xnew2;
end
trantX=transpose(antX);
antlmax=(trantX*(L\antX))/(trantX*antX)
lmin=1/antlmax
CN=lmax/lmin
end
1 Comment
Suman Sahu
on 10 Mar 2023
Similar questions have been asked by other users. Please go through these answers to see if they may be helpful to your case.
Answers (1)
Harsh Sanghai
on 21 Mar 2023
Hi,
The Power Method is typically used to find the largest eigenvalue and its associated eigenvector of a matrix. To find the smallest eigenvalue, you can use the Inverse Power Method, which is a variant of the Power Method.
Here is the modified code that implements the Inverse Power Method to find the smallest eigenvalue:
function [dk1, dkinf, CN] = fun(x)
n = numel(x)-1;
psi = @(x)exp(-3*x.^2);
L = zeros(n+1);
for i = 1:n+1
L(i,:) = psi(x(1:n+1)-x(i));
end
antL = inv(L);
A = max(sum(abs(L)));
B = max(sum(abs(antL)));
dk1 = A*B;
C = max(sum(abs(L')));
D = max(sum(abs(antL')));
dkinf = C*D;
% Inverse Power Method to find the smallest eigenvalue
xold = ones(n+1, 1);
mu = 0; % initial guess for eigenvalue
tol = 1e-10; % tolerance for convergence
maxiter = 100; % maximum number of iterations
for k = 1:maxiter
xnew = L\xold;
mu_new = (xnew'*xold)/(xold'*xold);
if abs(mu_new - mu) < tol
break;
end
xold = xnew;
mu = mu_new;
end
lmin = mu;
CN = lmax/lmin;
end
0 Comments
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!