From b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b Mon Sep 17 00:00:00 2001 From: priyanka Date: Wed, 24 Jun 2015 15:03:17 +0530 Subject: initial commit / add all books --- 845/CH5/EX5.10/Ex5_10.sce | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 845/CH5/EX5.10/Ex5_10.sce (limited to '845/CH5/EX5.10/Ex5_10.sce') 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 =") -- cgit