![](https://csdnimg.cn/release/download_crawler_static/86311443/bg1.jpg)
é5y•<„¡—-:\
h2017011307
5.1
žŒ…¹
(BÕ¡—é5!'y•<Êù”„y•Ï
—Õ
Ç(þ,—Õ5.1„ž(BÕ
•“ú
eigenvalue: 12.254327
eigenvector: 0.674020 -1.000000 0.889560
Value of A
*
x: 8.259659 -12.254318 10.900937
Value of lambda
*
x: 8.259659 -12.254327 10.900955
eigenvalue: 98.521699
eigenvector: -0.603972 1.000000 -0.251135 0.148953
Value of A
*
x: -59.504381 98.521698 -24.742259 14.675146
Value of lambda
*
x: -59.504381 98.521699 -24.742260 14.675146
$µ“ú+h:$*é5„BãÓœ
s.ã
1 function [] = solve(A)
2 n = length(A);
3 x = ones(n, 1);
4 l old = NaN;
5 k = 0;
6 while (1)
7 x = A
*
x;
8 k = k+1;
9 l new = max(abs(x));
10 x = x/l new;
11 if (abs(l old - l new) < 1e-5), break; end
12 l old = l new;
13 end
14 fprintf("eigenvalue: %f\n", l old);
15 fprintf("eigenvector: %f %f %f %f", x); fprintf("\n");
16 fprintf("Value of A
*
x: %f %f %f %f", (A
*
x)'); ...
fprintf("\n");
17 fprintf("Value of lambda
*
x: %f %f %f %f", (l old
*
x)); ...
fprintf("\n\n");
18 end
1