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 /845/CH5/EX5.10/Ex5_10.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 '845/CH5/EX5.10/Ex5_10.sce')
-rwxr-xr-x | 845/CH5/EX5.10/Ex5_10.sce | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/845/CH5/EX5.10/Ex5_10.sce b/845/CH5/EX5.10/Ex5_10.sce new file mode 100755 index 000000000..83ae771b0 --- /dev/null +++ b/845/CH5/EX5.10/Ex5_10.sce @@ -0,0 +1,35 @@ +//Example 5.10
+
+clc
+clear
+
+x = 3:7;
+y = [31.9 34.6 33.8 27 31.6];
+
+delx = x(2) - x(1);
+mu1 = delx * sum(y);
+mu2 = delx * sum(x.*y);
+mu3 = delx * sum(x^2 .*y);
+
+n = length(y);
+l = x(1) - delx/2;
+u = x(n) + delx/2;
+
+t0 = u-l;
+t1 = integrate("x",'x',l,u);
+t2 = integrate("x^2",'x',l,u);
+t3 = integrate("x^3",'x',l,u);
+t4 = integrate("x^4",'x',l,u);
+
+M1 = [t2 t1 t0; t3 t2 t1; t4 t3 t2];
+M2 = [mu1; mu2; mu3];
+M1 = round(M1*10^2)/10^2;
+M = M1\M2;
+
+c = M(1);
+b = M(2);
+a = M(3);
+
+disp(round(a*10^4)/10^4, "a =")
+disp(round(b*10^4)/10^4, "b =")
+disp(round(c*10^4)/10^4, "c =")
|