0 1 0
通解kx+x0
Page65 Ex 4
>> x0=[0.2 0.8]';a=[0.99 0.05;0.01 0.95]; >> x1=a*x, x2=a^2*x, x10=a^10*x >> x=x0;for i=1:1000,x=a*x;end,x x = 0.8333 0.1667
>> x0=[0.8 0.2]';
>> x=x0;for i=1:1000,x=a*x;end,x x = 0.8333 0.1667
>> [v,e]=eig(a) v =
0.9806 -0.7071 0.1961 0.7071 e = 1.0000 0 0 0.9400
>> v(:,1)./x ans = 1.1767
1.1767 成比例,说明x是最大特征值对应的特征向量
Page65 Ex5
用到公式(3.11)(3.12)
>> B=[6,2,1;2.25,1,0.2;3,0.2,1.8];x=[25 5 20]'; >> C=B/diag(x) C =
0.2400 0.4000 0.0500 0.0900 0.2000 0.0100 0.1200 0.0400 0.0900 >> A=eye(3,3)-C A =
0.7600 -0.4000 -0.0500 -0.0900 0.8000 -0.0100 -0.1200 -0.0400 0.9100 >> D=[17 17 17]';x=A\\D x = 37.5696 25.7862 24.7690
Page65 Ex 6
(1)
>> a=[4 1 -1;3 2 -6;1 -5 3];det(a),inv(a),[v,d]=eig(a) ans = -94 ans =
0.2553 -0.0213 0.0426 0.1596 -0.1383 -0.2234 0.1809 -0.2234 -0.0532 v =
0.0185 -0.9009 -0.3066 -0.7693 -0.1240 -0.7248 -0.6386 -0.4158 0.6170 d =
-3.0527 0 0 0 3.6760 0 0 0 8.3766 (2)
>> a=[1 1 -1;0 2 -1;-1 2 0];det(a),inv(a),[v,d]=eig(a) ans = 1 ans =
2.0000 -2.0000 1.0000 1.0000 -1.0000 1.0000 2.0000 -3.0000 2.0000 v =
-0.5773 0.5774 + 0.0000i 0.5774 - 0.0000i -0.5773 0.5774 0.5774
-0.5774 0.5773 - 0.0000i 0.5773 + 0.0000i d = 1.0000 0 0
0 1.0000 + 0.0000i 0 0 0 1.0000 - 0.0000i (3)
>> A=[5 7 6 5;7 10 8 7;6 8 10 9;5 7 9 10] A = 5 7 6 5 7 10 8 7 6 8 10 9 5 7 9 10
>> det(A),inv(A), [v,d]=eig(A) ans = 1 ans =
68.0000 -41.0000 -17.0000 10.0000 -41.0000 25.0000 10.0000 -6.0000 -17.0000 10.0000 5.0000 -3.0000 10.0000 -6.0000 -3.0000 2.0000 v =
0.8304 0.0933 0.3963 0.3803 -0.5016 -0.3017 0.6149 0.5286 -0.2086 0.7603 -0.2716 0.5520 0.1237 -0.5676 -0.6254 0.5209 d =
0.0102 0 0 0 0 0.8431 0 0 0 0 3.8581 0 0 0 0 30.2887 (4)(以n=5为例) 方法一(三个for) n=5;
for i=1:n, a(i,i)=5;end for i=1:(n-1),a(i,i+1)=6;end for i=1:(n-1),a(i+1,i)=1;end a
方法二(一个for)