I need help displaying the eigenvalue after each iteration

2 次查看(过去 30 天)

回答(1 个)

Torsten
Torsten 2023-11-29
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

类别

Help CenterFile Exchange 中查找有关 Linear Algebra 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by