Inverse Power Method Doesnt Work

9 visualizaciones (últimos 30 días)
Filippos Georgios Sarakis
Filippos Georgios Sarakis el 19 de En. de 2023
Respondida: Harsh Sanghai el 21 de Mzo. de 2023
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

Respuestas (1)

Harsh Sanghai
Harsh Sanghai el 21 de Mzo. de 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

Categorías

Más información sobre Linear Algebra en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by