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 /1332/CH11/EX11.4/11_4.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 '1332/CH11/EX11.4/11_4.sce')
-rwxr-xr-x | 1332/CH11/EX11.4/11_4.sce | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/1332/CH11/EX11.4/11_4.sce b/1332/CH11/EX11.4/11_4.sce new file mode 100755 index 000000000..6e787e59a --- /dev/null +++ b/1332/CH11/EX11.4/11_4.sce @@ -0,0 +1,19 @@ +//Example 11.4
+//Power Method
+//Page no. 345
+clc;close;clear;
+
+A=[1,2;3,4];
+e=0.001;
+q0=[1;1];
+for i=1:5
+ q1=A*q0;
+ a=max(q1)
+ for j=1:2
+ q2(j)=q1(j)/a;
+ end
+ printf('\nq(%i) = %.4f a = %.4f Scaled q(%i) = %.4f\n %.4f %i\n\n',i,q1(1),a,i,q2(1),q1(2),q2(2))
+ q1=q2;
+ q0=q1;
+end
+printf('Hence the largest eigenvalue is %.4f with the corresponding eigenvector as %.4f\n %i',a,q0(1),q0(2))
\ No newline at end of file |