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 /545/CH8/EX8.2/ch_8_eg_2.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 '545/CH8/EX8.2/ch_8_eg_2.sce')
-rwxr-xr-x | 545/CH8/EX8.2/ch_8_eg_2.sce | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/545/CH8/EX8.2/ch_8_eg_2.sce b/545/CH8/EX8.2/ch_8_eg_2.sce new file mode 100755 index 000000000..501b7d1df --- /dev/null +++ b/545/CH8/EX8.2/ch_8_eg_2.sce @@ -0,0 +1,28 @@ +clc
+disp("the soln of eg 8.2-->");
+for i=1:100, x(i)=0
+end
+iter=0, e1=1, f=1
+k=.1,D=10^-9,r=.01,delta_r=r/10,t1=k*delta_r^2/D
+while e1>1e-6 & f>1e-6 do iter=iter+1,for i=1:100, x1(i)=x(i),
+ end, for i=2:100, a(i)=1-(1/(i-1))
+ end, b(1)=-6-.t1*x1(1), for i=2:100, b(i)=-2-t1*x1(i)
+ end, c(1)=6, for i=2:99,c(i)=1+(1/(i-1))
+ end, for i=1:99,d(i)=0, end, d(100)=-100/99,
+ i=1, n=100, Beta(i)=b(i),
+ Gamma(i)=d(i)/Beta(i)
+ i1=i+1,
+ for j=i1:n, Beta(j)=b(j)-a(j)*c(j-1)/Beta(j-1),
+ Gamma(j)=(d(j)-a(j)*Gamma(j-1))/Beta(j),
+ end
+ x(n)=Gamma(n)
+ n1=n-i,
+ for k=1:n1, j=n-k,x(j)=Gamma(j)-c(j)*x(j+1)/Beta(j)
+ end
+ e1=abs(x(1)-x1(1)),
+ f=abs(x(100)-x1(100)),
+end
+disp("the solution by TDMA of node 77 to 99 by 2nd order rxn. is");
+for i=77:100,
+ disp(x(i));
+end
\ No newline at end of file |