I need help displaying the eigenvalue after each iteration

1 view (last 30 days)

Answers (1)

Torsten
Torsten on 29 Nov 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

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!