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 /964/CH29/EX29.1 | |
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 '964/CH29/EX29.1')
-rwxr-xr-x | 964/CH29/EX29.1/29_1.sce | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/964/CH29/EX29.1/29_1.sce b/964/CH29/EX29.1/29_1.sce new file mode 100755 index 000000000..85894b768 --- /dev/null +++ b/964/CH29/EX29.1/29_1.sce @@ -0,0 +1,38 @@ +//clc()
+wf = 1.5;
+for i = 1:5
+ for j = 1:5
+ T(i,j) = 0;
+ if j == 1 then
+ T(i,j) = 0;//C
+ else
+ if j == 5 then
+ T(i,j) = 100;//C
+ end
+ end
+ if i == 1 then
+ T(i,j) = 75;//C
+ else
+ if i == 5 then
+ T(i,j) = 50;//C
+ end
+ end
+ end
+end
+e = 100;
+while e>1
+for i=1:5
+ for j = 1:5
+ if i>1 & j>1 & i<5 & j<5 then
+ Tn(i,j) = (T(i + 1,j) + T(i-1,j) + T(i,j+1) + T(i,j-1))/4;
+ Tn(i,j) = wf * Tn(i,j) + (1-wf)*T(i,j);
+ if i==2 & j==2 then
+ e = abs((Tn(i,j) - T(i,j)) * 100/ (Tn(i,j)));
+ end
+ T(i,j) = Tn(i,j);
+ end
+ end
+end
+end
+disp(T(2:4,2:4),"for error < 1, the temperatures are")
+
|