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 /964/CH25/EX25.5 | |
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 '964/CH25/EX25.5')
-rwxr-xr-x | 964/CH25/EX25.5/25_5.sce | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/964/CH25/EX25.5/25_5.sce b/964/CH25/EX25.5/25_5.sce new file mode 100755 index 000000000..111e8d0ca --- /dev/null +++ b/964/CH25/EX25.5/25_5.sce @@ -0,0 +1,21 @@ +//clc()
+//y' = 4*exp(0.8*x) - 0.5*y
+//y = 4*(exp(0.8*x) - exp(-0.5*x))/1.3 + 2*exp(-0.5*x)
+x = 0:1:4;
+disp(x)
+x1 = 0;
+y1 = 2;
+y2(1) = y1;
+for i = 1:5
+ y(i) = 4*(exp(0.8*x(i)) - exp(-0.5*x(i)))/1.3 + 2*exp(-0.5*x(i));
+ dy(i) = 4*exp(0.8*x(i)) - 0.5*y2(i);
+ y2(i + 1) = y2(i) + dy(i);
+ if i>1 then
+ m(i) = (dy(i) + dy(i-1))/2;
+ y2(i) = y2(i-1) + m(i);
+ dy(i) = 4*exp(0.8*x(i)) - 0.5*y2(i);
+ end
+ e(i) = (y(i) - y2(i)) * 100 / y(i);
+end
+disp(y2(1:5),"By heuns method(1 iteration)")
+disp("%",e(1:5),"error = ")
|