diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /191/CH4/EX4.9/Example4_9.sce | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '191/CH4/EX4.9/Example4_9.sce')
-rwxr-xr-x | 191/CH4/EX4.9/Example4_9.sce | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/191/CH4/EX4.9/Example4_9.sce b/191/CH4/EX4.9/Example4_9.sce new file mode 100755 index 000000000..058788449 --- /dev/null +++ b/191/CH4/EX4.9/Example4_9.sce @@ -0,0 +1,35 @@ +//Given's Method
+//reduce A1 to tridiagonal form
+clc;
+clear;
+close();
+format('v',7);
+A1 = [2 -1 1 4;-1 3 1 2;1 1 5 -3;4 2 -3 6];
+disp(A1,'A = ')
+// zero is created at (1,3)
+//by taking the rotation matrix X1=[c 0 s; 0 1 0;-s 0 c]; where c=cos and s=sin
+//O is theta
+
+count =0;
+for i=1:(4-2)
+ for j=i+2:4
+ if abs(A1(i,j))>0 then
+ p=i+1;q=j;
+ O = -atan(A1(p-1,q)/(A1(p-1,p)));
+ c = cos(O);
+ s = sin(O);
+ X = eye(4,4);
+ X(p,p)=c;
+ X(q,q)=c;
+ X(p,q)=s;
+ X(q,p)=-s;
+
+ A1 = X'*A1*X;
+ disp(A1, 'Ai = ');
+ disp(X ,'X = ');
+ disp(O, 'Theta = ');
+ count = count+1;
+ end
+ end
+end
+disp(A1,'Reduced A1 to trigonal matrix is : ')
\ No newline at end of file |