summaryrefslogtreecommitdiff
path: root/964/CH30
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /964/CH30
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 '964/CH30')
-rwxr-xr-x964/CH30/EX30.1/30_1.sce33
-rwxr-xr-x964/CH30/EX30.2/30_2.sce36
-rwxr-xr-x964/CH30/EX30.3/30_3.sce17
-rwxr-xr-x964/CH30/EX30.4/30_4.sce14
-rwxr-xr-x964/CH30/EX30.5/30_5.sce44
5 files changed, 144 insertions, 0 deletions
diff --git a/964/CH30/EX30.1/30_1.sce b/964/CH30/EX30.1/30_1.sce
new file mode 100755
index 000000000..ccd79dbc1
--- /dev/null
+++ b/964/CH30/EX30.1/30_1.sce
@@ -0,0 +1,33 @@
+//clc()
+l = 10;//cm
+k1 = 0.49;//cal/(s.cm.C)
+x = 2;//cm
+dt = 0.1;//sec
+T0 = 100;//C
+T10 = 50;//C
+C = 0.2174;//cal/(g.C)
+rho = 2.7;//g/cm^3
+k = k1/(C*rho);
+L = k * dt / x^2;
+disp(L,"L =")
+T(1,1) = 100;
+T(1,2) = 0;
+T(1,3) = 0;
+T(1,4) = 0;
+T(1,5) = 0;
+T(1,6) = 50;
+T(2,1) = 100;
+T(2,6) = 50;
+for i = 2:3
+ for j = 2:5
+ T(i,j) = T(i-1,j) + L * (T(i-1,j+1) - 2* T(i-1,j) + T(i-1,j-1));
+ end
+end
+disp(T(2,2),"T11 = ")
+disp(T(2,3),"T12 = ")
+disp(T(2,4),"T13 = ")
+disp(T(2,5),"T14 = ")
+disp(T(3,2),"T21 = ")
+disp(T(3,3),"T22 = ")
+disp(T(3,4),"T23 = ")
+disp(T(3,5),"T24 = ")
diff --git a/964/CH30/EX30.2/30_2.sce b/964/CH30/EX30.2/30_2.sce
new file mode 100755
index 000000000..7ca3e213a
--- /dev/null
+++ b/964/CH30/EX30.2/30_2.sce
@@ -0,0 +1,36 @@
+//clc()
+l = 10;//cm
+k1 = 0.49;//cal/(s.cm.C)
+x = 2;//cm
+dt = 0.1;//sec
+C = 0.2174;//cal/(g.C)
+rho = 2.7;//g/cm^3
+k = k1/(C*rho);
+L = k * dt / x^2;
+disp(L,"L =")
+//now, at t = 0, 1.04175 *T'1 + 0.020875 *T'2 = 0 + 0.020875*100
+//similarly getting other simultaneous eqautions,we get the following matrix
+A = [1.04175,-0.020875,0,0;-0.020875,1.04175,-0.020875,0;0,-0.020875,1.04175,-0.020875;0,0,-0.020875,1.04175];
+B = [2.0875;0;0;1.04375];
+X = inv(A) * B;
+T11 = det(X(1,1));
+T12 = det(X(2,1));
+T13 = det(X(3,1));
+T14 = det(X(4,1));
+disp("for t = 0")
+disp(T11,"T11 = ")
+disp(T12,"T12 = ")
+disp(T13,"T13 = ")
+disp(T14,"T14 = ")
+//to solve for t = 0.2, the right hand side vector is modified to D,
+D = [4.09215;0.04059;0.02090;2.04069];
+Y = inv(A)*D;
+T21 = det(Y(1,1));
+T22 = det(Y(2,1));
+T23 = det(Y(3,1));
+T24 = det(Y(4,1));
+disp("for t = 0.2")
+disp(T21,"T21 = ")
+disp(T22,"T22 = ")
+disp(T23,"T23 = ")
+disp(T24,"T24 = ")
diff --git a/964/CH30/EX30.3/30_3.sce b/964/CH30/EX30.3/30_3.sce
new file mode 100755
index 000000000..fce82e510
--- /dev/null
+++ b/964/CH30/EX30.3/30_3.sce
@@ -0,0 +1,17 @@
+//clc()
+//using crank nicolson method, we get simultaneous equations which can be simplified to following matrics
+A = [2.04175,-0.020875,0,0;-0.020875,2.04175,-0.020875,0;0,-0.020875,2.04175,-0.020875;0,0,-0.020875,2.04175];
+B = [4.175;0;0;2.0875];
+X = inv(A)*B;
+disp("at t = 0.1 s")
+disp(det(X(1,1)),"T11 = ")
+disp(det(X(2,1)),"T12 = ")
+disp(det(X(3,1)),"T13 = ")
+disp(det(X(4,1)),"T14 = ")
+C = [8.1801;0.0841;0.0427;4.0901];
+Y = inv(A)*C;
+disp("at t = 0.2 s")
+disp(det(Y(1,1)),"T21 = ")
+disp(det(Y(2,1)),"T22 = ")
+disp(det(Y(3,1)),"T23 = ")
+disp(det(Y(4,1)),"T24 = ")
diff --git a/964/CH30/EX30.4/30_4.sce b/964/CH30/EX30.4/30_4.sce
new file mode 100755
index 000000000..3875e69b8
--- /dev/null
+++ b/964/CH30/EX30.4/30_4.sce
@@ -0,0 +1,14 @@
+//clc()
+x = 2;//cm
+L = 10;//cm
+k = 0.835;//cm^2/s
+t = 10;//s
+n = 1:10000;
+T = 324.* (x/L + sum(2.*((-1)^n).*sin(n.*x/L).*exp(-n^2.* %pi^2.* k.* t / L^2)/(n.*%pi)));
+disp(T,"T[2,10]analytical = ")
+Tex = 64.97;
+disp(Tex,"T[2,10]explicit = ")
+Tim = 64.49;
+disp(Tim,"T[2,10]implicit = ")
+Tcn = 64.73;
+disp(Tcn,"T[2,10]crank-nicolson = ")
diff --git a/964/CH30/EX30.5/30_5.sce b/964/CH30/EX30.5/30_5.sce
new file mode 100755
index 000000000..a8ca5d54a
--- /dev/null
+++ b/964/CH30/EX30.5/30_5.sce
@@ -0,0 +1,44 @@
+//clc()
+x = 10;//cm
+L = 0.0835;
+t1 = 5;
+//for first step t = 5 is applied to nodes (1,1) , (1,2) and (1,3) to yield following matrices
+A = [2.167,-0.0835,0;-0.0835,2.167,-0.0835;0,-0.0835,2.167];
+B = [6.2625;6.2625;14.6125];
+X = inv(A)*B;
+disp("At t = 5 s")
+disp(det(X(1,1)),"T11 = ")
+disp(det(X(2,1)),"T12 = ")
+disp(det(X(3,1)),"T13 = ")
+//similarly we get,
+T21 = 0.1274;
+T22 = 0.2900;
+T23 = 4.1291;
+T31 = 2.0181;
+T32 = 2.2477;
+T33 = 6.0256;
+disp(T21,"T21 = ")
+disp(T22,"T22 = ")
+disp(T23,"T23 = ")
+disp(T31,"T31 = ")
+disp(T32,"T32 = ")
+disp(T33,"T33 = ")
+C = [13.0639;0.2577;8.0619];
+Y = inv(A)*C;
+disp("At t = 10 s")
+disp(det(Y(1,1)),"T11 = ")
+disp(det(Y(2,1)),"T12 = ")
+disp(det(Y(3,1)),"T13 = ")
+//similarly we get,
+T21 = 6.1683;
+T22 = 0.8238;
+T23 = 4.2359;
+T31 = 13.1120;
+T32 = 8.3207;
+T33 = 11.3606;
+disp(T21,"T21 = ")
+disp(T22,"T22 = ")
+disp(T23,"T23 = ")
+disp(T31,"T31 = ")
+disp(T32,"T32 = ")
+disp(T33,"T33 = ")