summaryrefslogtreecommitdiff
path: root/260/CH13/EX13.14/13_14.sce
diff options
context:
space:
mode:
authorprashantsinalkar2017-10-10 12:27:19 +0530
committerprashantsinalkar2017-10-10 12:27:19 +0530
commit7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 (patch)
treedbb9e3ddb5fc829e7c5c7e6be99b2c4ba356132c /260/CH13/EX13.14/13_14.sce
parentb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (diff)
downloadScilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.gz
Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.bz2
Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.zip
initial commit / add all books
Diffstat (limited to '260/CH13/EX13.14/13_14.sce')
-rw-r--r--260/CH13/EX13.14/13_14.sce40
1 files changed, 40 insertions, 0 deletions
diff --git a/260/CH13/EX13.14/13_14.sce b/260/CH13/EX13.14/13_14.sce
new file mode 100644
index 000000000..7c857b4a6
--- /dev/null
+++ b/260/CH13/EX13.14/13_14.sce
@@ -0,0 +1,40 @@
+//Eg-13.14
+//pg-556
+
+clear
+clc
+
+deff('out = func(in1,in2)','out = -0.3*(in2-50)^1.25')
+
+h = 0.1;
+x(1) = 0;
+y(1) = 100;
+y(2) = 96.20249; //from the question
+x(2) = x(1) + h;
+
+n = 10/h;
+
+for(i = 1:n)
+
+ x(i+1) = x(i) + h ;
+
+end
+
+
+
+
+for(i = 2:n)
+
+ yb(i+1) = y(i-1) + 2*h*func(x(i),y(i));
+ y(i+1) = y(i) + h/2*(func(x(i),y(i)) + func(x(i+1),yb(i+1)));
+
+end
+
+printf(' x y\n')
+for(i = 1:10)
+
+ printf('%f %f\n',x(i*10+1),y(i*10+1))
+
+end
+
+printf('\n\nThe value of T at t = 10 agrees with that of the analytical solution:\nT = 50 + (0.075t + 0.37604)^-4\n') \ No newline at end of file