diff options
author | prashantsinalkar | 2017-10-10 12:27:19 +0530 |
---|---|---|
committer | prashantsinalkar | 2017-10-10 12:27:19 +0530 |
commit | 7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 (patch) | |
tree | dbb9e3ddb5fc829e7c5c7e6be99b2c4ba356132c /260/CH11/EX11.13/11_13.sce | |
parent | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (diff) | |
download | Scilab-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/CH11/EX11.13/11_13.sce')
-rw-r--r-- | 260/CH11/EX11.13/11_13.sce | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/260/CH11/EX11.13/11_13.sce b/260/CH11/EX11.13/11_13.sce new file mode 100644 index 000000000..fb39cfb49 --- /dev/null +++ b/260/CH11/EX11.13/11_13.sce @@ -0,0 +1,38 @@ +//Eg-11.13
+//pg-495
+
+clear
+clc
+
+//Note that the values of log(y) are not equally spaced.
+
+x(1) = -2.9999;
+x(2) = -2.4486;
+x(3) = -2.1599;
+x(4) = -1.9893;
+x(5) = -1.8687;
+x(6) = -1.7734;
+x(7) = -1.6990;
+
+y(1) = 4.32;
+y(2) = 5.02;
+y(3) = 5.39;
+y(4) = 5.26;
+y(5) = 5.10;
+y(6) = 4.84;
+y(7) = 4.76;
+
+sum1 = 0;
+
+for(i = 1:6)
+ h(i) = x(i+1) - x(i);
+ sum1 = sum1 + h(i)/2*(y(i+1) + y(i));
+end
+
+printf('The value of the integral is %f',sum1)
+
+plot(x,y)
+xlabel('log(y)')
+ylabel('y/(y-yi)')
+
+printf('\n\n The data points and trapezoid approximations are plotted in the figure.\n The area under the curve represents the value of the integral.\n Graphical integration gives I = 6.556\n')
\ No newline at end of file |