summaryrefslogtreecommitdiff
path: root/1670/CH4/EX4.11/4_11.sce
blob: 63c49dd08224993c31810f9b1fdae0d044367cb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//Example 4.11
//Givens Method
//Page no. 106
clc;close;clear;

A=[1,2,2;2,1,2;2,2,1];
n=3;
for k=1:1
    max1=0
i1=2;j1=3;
fi=(atan((2*A(i1,j1))/(A(i1,i1)-A(j1,j1)+10^-20)))/2
disp(fi,'fi = ')
O1=eye(n,n)
O1(i1,j1)=-sin(fi)
O1(j1,i1)=sin(fi)
O1(i1,i1)=cos(fi)
O1(j1,j1)=cos(fi)
disp(O1,'O1 = ')
A=inv(O1)*A*O1
disp(A,'B = ')
end
printf('\n\n')
l=poly(0,'lb')
A=A-l*eye(n,n)
disp(-det(A),'Characteristic Equation = ')
A=roots(det(A))
printf('\n\n The eigenvalues are : \n\n')
for i=1:n
    printf('\tl%i = %g\t',i,A(i))
end