summaryrefslogtreecommitdiff
path: root/964/CH31
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /964/CH31
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/CH31')
-rwxr-xr-x964/CH31/EX31.1/31_1.jpegbin0 -> 27375 bytes
-rwxr-xr-x964/CH31/EX31.1/31_1.sce26
-rwxr-xr-x964/CH31/EX31.2/31_2.sce21
-rwxr-xr-x964/CH31/EX31.3/31_3.sce38
4 files changed, 85 insertions, 0 deletions
diff --git a/964/CH31/EX31.1/31_1.jpeg b/964/CH31/EX31.1/31_1.jpeg
new file mode 100755
index 000000000..772959d78
--- /dev/null
+++ b/964/CH31/EX31.1/31_1.jpeg
Binary files differ
diff --git a/964/CH31/EX31.1/31_1.sce b/964/CH31/EX31.1/31_1.sce
new file mode 100755
index 000000000..be47cb8d8
--- /dev/null
+++ b/964/CH31/EX31.1/31_1.sce
@@ -0,0 +1,26 @@
+clc;
+clear;
+//d2T/dx2=-10; equation to be solved
+//T(0,t)=40; boundary condition
+//T(10,t)=200; boundary condition
+//f(x)=10; uniform heat source
+//we assume a solution T=a*X^2 + b*x +c
+//differentiating twice we get d2T/dx2=2*a
+a=-10/2;
+//using first boundary condition
+c=40;
+//using second boundary condtion
+b=66;
+//hence final solution T=-5*x^2 + 66*x + 40
+function T=f(x)
+ T=-5*x^2 + 66*x + 40
+endfunction
+count=1;
+for i=0:0.1:11
+ T(count)=f(i);
+ count=count+1;
+end
+x=0:0.1:11
+plot(x,T)
+xtitle("Temperature(T) vs distance(x)","x (cm)","T (units)")
+
diff --git a/964/CH31/EX31.2/31_2.sce b/964/CH31/EX31.2/31_2.sce
new file mode 100755
index 000000000..edfe41e4f
--- /dev/null
+++ b/964/CH31/EX31.2/31_2.sce
@@ -0,0 +1,21 @@
+clc;
+clear;
+xf=10;//cm
+xe=2.5;//cm
+//T(0,t)=40; boundary condition
+//T(10,t)=200; boundary condition
+//f(x)=10; uniform heat source
+function y=f(x)
+ y=10*(xe-x)/xe;
+endfunction
+int1=intg(0,xe,f)
+function y=g(x)
+ y=10*(x-0)/xe;
+endfunction
+int2=intg(0,xe,g)
+disp("The results are:")
+disp("0.4*T1-0.4*T2=-(dT/dx)*x1 + c1")
+disp(int1,"where c1=")
+disp("and")
+disp("-0.4*T1+0.4*T2=-(dT/dx)*x2 + c2")
+disp(int2,"where c2=")
diff --git a/964/CH31/EX31.3/31_3.sce b/964/CH31/EX31.3/31_3.sce
new file mode 100755
index 000000000..efcc59fe4
--- /dev/null
+++ b/964/CH31/EX31.3/31_3.sce
@@ -0,0 +1,38 @@
+//clc()
+wf = 01.5;
+for i = 1:41
+ for j = 1:41
+ T(i,j) = 0;
+ if j == 1 then
+ T(i,j) = 0;//C
+ else
+ if j == 41 then
+ T(i,j) = 100;//C
+ end
+ end
+ if i == 1 then
+ T(i,j) = 75;//C
+ else
+ if i == 41 then
+ T(i,j) = 50;//C
+ end
+ end
+ end
+end
+e = 100;
+while e>1
+for i=1:41
+ for j = 1:41
+ if i>1 & j>1 & i<41 & j<41 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,"for error < 1, the temperatures are")
+