summaryrefslogtreecommitdiff
path: root/1670/CH3/EX3.6/3_6.sce
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /1670/CH3/EX3.6/3_6.sce
downloadScilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip
initial commit / add all books
Diffstat (limited to '1670/CH3/EX3.6/3_6.sce')
-rwxr-xr-x1670/CH3/EX3.6/3_6.sce38
1 files changed, 38 insertions, 0 deletions
diff --git a/1670/CH3/EX3.6/3_6.sce b/1670/CH3/EX3.6/3_6.sce
new file mode 100755
index 000000000..0c16f5324
--- /dev/null
+++ b/1670/CH3/EX3.6/3_6.sce
@@ -0,0 +1,38 @@
+//Example 3.6
+//Gauss-Jordan Method
+//Page no. 57
+
+clc;clear;close;
+
+A=[10,1,1,12;1,10,1,12;1,1,10,12]; //augmented matrix
+
+for i=1:3
+ j=i
+ while (A(i,i)==0 & j<=3)
+ for k=1:4
+ B(1,k)=A(j+1,k)
+ A(j+1,k)=A(i,k)
+ A(i,k)=B(1,k)
+ end
+ disp(A)
+ j=j+1
+ end
+ for k=4:-1:i
+ A(i,k)=A(i,k)/A(i,i)
+ end
+ disp(A)
+ for k=1:3
+ if(k~=i) then
+ l=A(k,i)/A(i,i)
+ for m=i:4
+ A(k,m)=A(k,m)-l*A(i,m)
+ end
+ end
+
+ end
+ disp(A)
+end
+
+for i=1:3
+ printf('\nx(%i) = %g\n',i,A(i,4))
+end \ No newline at end of file