summaryrefslogtreecommitdiff
path: root/243/CH14/EX14.6/14_06.sce
blob: 518a19e81171f3adb9c7266af6ae134aea9e7428 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
//Example No. 14_06
//Power method
//Pg No. 478
clear ; close ; clc ;

A = [ 1 2 0 ; 2 1 0 ; 0 0 -1 ]
X(:,1) = [0 ; 1 ; 0]
for i = 1:7
    Y(:,i) = A*X(:,i)
    X(:,i+1) = Y(:,i)/max(Y(:,i))
end
disp('  0      1       2      3           4            5            6             7 ','Iterations')
disp(X,'X = ',[[%nan ;%nan ;%nan] Y ],'Y = ')