diff options
author | prashantsinalkar | 2017-10-10 12:27:19 +0530 |
---|---|---|
committer | prashantsinalkar | 2017-10-10 12:27:19 +0530 |
commit | 7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 (patch) | |
tree | dbb9e3ddb5fc829e7c5c7e6be99b2c4ba356132c /260/CH5/EX5.9/5_9.sce | |
parent | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (diff) | |
download | Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.gz Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.bz2 Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.zip |
initial commit / add all books
Diffstat (limited to '260/CH5/EX5.9/5_9.sce')
-rw-r--r-- | 260/CH5/EX5.9/5_9.sce | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/260/CH5/EX5.9/5_9.sce b/260/CH5/EX5.9/5_9.sce new file mode 100644 index 000000000..e44d632f2 --- /dev/null +++ b/260/CH5/EX5.9/5_9.sce @@ -0,0 +1,52 @@ +//Eg-5.9
+//pg-232
+
+clear
+clc
+
+A = [0 1 1.5;-5 -0.5 1;-1 2 3.5];
+z = [1;1;1];
+lambda = zeros(3,1);
+z_in = z;
+
+for(i = 1:50)
+ a = A*z;
+ b = (sum(a.^2))^.5;
+ lambda(1) = b;
+ z = a/b;
+ z0 = z;
+end
+
+
+B = A - lambda(1)*eye(3,3);
+y = B*z_in;
+
+for(i = 1:50)
+ c = B*y;
+ d = (sum(c.^2))^.5;
+ lambda(2) = d;
+ y = c/d;
+ z1 = y;
+end
+
+C = (A - lambda(1)*eye(3,3))*(A - lambda(2)*eye(3,3));
+u = C*z_in;
+
+for(i = 1:50)
+ e = C*u;
+ f = (sum(e.^2))^.5;
+ lambda(3) = f;
+ u = e/f;
+ z2 = u;
+end
+
+disp("eigen values")
+disp(lambda)
+
+disp("corresponding eigen vectors")
+disp(z0)
+disp(z1)
+disp(z2)
+
+
+//Note that the eigen vector corresponding to lambda value of 1 is not matching with that in the text book, the method followed here is giving correct answers for the other two eigen values. So the eigen vector given in the book is wrong.
|