diff options
Diffstat (limited to '964/CH26/EX26.1')
-rwxr-xr-x | 964/CH26/EX26.1/26_1.sce | 40 | ||||
-rwxr-xr-x | 964/CH26/EX26.1/26_1_1.jpeg | bin | 0 -> 34007 bytes | |||
-rwxr-xr-x | 964/CH26/EX26.1/26_1_2.jpeg | bin | 0 -> 24619 bytes |
3 files changed, 40 insertions, 0 deletions
diff --git a/964/CH26/EX26.1/26_1.sce b/964/CH26/EX26.1/26_1.sce new file mode 100755 index 000000000..0af6c6d95 --- /dev/null +++ b/964/CH26/EX26.1/26_1.sce @@ -0,0 +1,40 @@ +clc;
+clear;
+function yp=f(t,y)
+ yp=-1000*y+3000-2000*exp(-t)
+endfunction
+y0=0;
+//explicit euler
+h1=0.0005;
+y1(1)=y0;
+count=2;
+t=0:0.0001:0.006
+for i=0:0.0001:0.0059
+ y1(count)=y1(count-1)+f(i,y1(count-1))*h1
+ count=count+1;
+end
+plot(t,y1)
+h2=0.0015;
+y2(1)=y0;
+count=2;
+t=0:0.0001:0.006
+for i=0:0.0001:0.0059
+ y2(count)=y2(count-1)+f(i,y2(count-1))*h2
+ count=count+1;
+end
+plot(t,y2,'.-')
+xtitle("y vs t","t","y")
+h=legend(["h-0.0005","h=0.0015"])
+clf();
+//implicit order
+h3=0.05;
+y3(1)=y0;
+count=2;
+t=0:0.01:0.4
+for j=0:0.01:0.39
+ y3(count)=(y3(count-1)+3000*h3-2000*h3*exp(-(j+0.01)))/(1+1000*h3)
+ count=count+1;
+end
+
+plot(t,y3)
+xtitle("y vs t","t","y")
diff --git a/964/CH26/EX26.1/26_1_1.jpeg b/964/CH26/EX26.1/26_1_1.jpeg Binary files differnew file mode 100755 index 000000000..29a2401f8 --- /dev/null +++ b/964/CH26/EX26.1/26_1_1.jpeg diff --git a/964/CH26/EX26.1/26_1_2.jpeg b/964/CH26/EX26.1/26_1_2.jpeg Binary files differnew file mode 100755 index 000000000..33d1479ac --- /dev/null +++ b/964/CH26/EX26.1/26_1_2.jpeg |