I need help displaying the eigenvalue after each iteration

1 visualización (últimos 30 días)
Brandon
Brandon el 29 de Nov. de 2023
Respondida: Torsten el 29 de Nov. de 2023

Respuestas (1)

Torsten
Torsten el 29 de Nov. de 2023
A = rand(10);
ATA = A'*A;
x0 = rand(10,1);
for iter = 1:10
y = ATA*x0;
x = y/norm(y);
x0 = x;
y
end
y = 10×1
13.8330 16.6010 15.4737 18.7605 17.6278 12.7441 19.7612 22.2199 17.2281 15.1539
y = 10×1
8.0529 9.6059 9.0273 10.7622 10.2690 7.4746 11.4399 12.8886 9.9449 8.7585
y = 10×1
8.0555 9.6053 9.0300 10.7568 10.2722 7.4780 11.4398 12.8884 9.9438 8.7575
y = 10×1
8.0556 9.6053 9.0301 10.7565 10.2724 7.4782 11.4398 12.8883 9.9437 8.7575
y = 10×1
8.0556 9.6053 9.0301 10.7565 10.2724 7.4782 11.4398 12.8883 9.9437 8.7575
y = 10×1
8.0556 9.6053 9.0301 10.7565 10.2724 7.4782 11.4398 12.8883 9.9437 8.7575
y = 10×1
8.0556 9.6053 9.0301 10.7565 10.2724 7.4782 11.4398 12.8883 9.9437 8.7575
y = 10×1
8.0556 9.6053 9.0301 10.7565 10.2724 7.4782 11.4398 12.8883 9.9437 8.7575
y = 10×1
8.0556 9.6053 9.0301 10.7565 10.2724 7.4782 11.4398 12.8883 9.9437 8.7575
y = 10×1
8.0556 9.6053 9.0301 10.7565 10.2724 7.4782 11.4398 12.8883 9.9437 8.7575
largest_eigenvalue_approx = x'*ATA*x
largest_eigenvalue_approx = 31.4387
max(eig(ATA))
ans = 31.4387

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by