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 /1332/CH19/EX19.5/19_5.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 '1332/CH19/EX19.5/19_5.sce')
-rwxr-xr-x | 1332/CH19/EX19.5/19_5.sce | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/1332/CH19/EX19.5/19_5.sce b/1332/CH19/EX19.5/19_5.sce new file mode 100755 index 000000000..3d17305b8 --- /dev/null +++ b/1332/CH19/EX19.5/19_5.sce @@ -0,0 +1,35 @@ +//Example 19.5
+//Lax Wendroff Method
+//Page no. 660
+clc;clear;close;
+
+c=-2;dt=0.07;dx=0.2;
+r=abs(c)*dt/dx;
+printf('\n x\ti\t|\tj -->\t')
+for i=0:6
+ printf(' %i\t',i)
+end
+printf('\n |\t|\t|\tt -->\t')
+for i=0:6
+ printf('%.3f\t',i*dt)
+end
+i=1;
+printf('\n---------------------------------------------------------------------------------------')
+for j=1:7
+ for i=1:6
+ if j==1 then
+ u(i,j)=0;
+ u(i+1,j)=0;
+ elseif i==1 then
+ u(i,j)=1
+ else
+ u(i,j)=r*(r-1)*u(i+1,j-1)/2+(1-r^2)*u(i,j-1)+r*(1+r)*u(i-1,j-1)/2
+ end
+ end
+end
+for i=1:6
+ printf('\n %.1f\t%i\t|\t\t',(i-1)*dx,i-1)
+ for j=1:7
+ printf('%.3f\t',u(i,j))
+ end
+end
\ No newline at end of file |