summaryrefslogtreecommitdiff
path: root/845/CH5/EX5.6
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /845/CH5/EX5.6
downloadScilab-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.6')
-rwxr-xr-x845/CH5/EX5.6/Ex5_6.sce20
1 files changed, 20 insertions, 0 deletions
diff --git a/845/CH5/EX5.6/Ex5_6.sce b/845/CH5/EX5.6/Ex5_6.sce
new file mode 100755
index 000000000..5d3aafd28
--- /dev/null
+++ b/845/CH5/EX5.6/Ex5_6.sce
@@ -0,0 +1,20 @@
+//Example 5.6
+
+clc
+clear
+
+X = 1:0.2:2;
+Y = [0.98 1.4 1.86 2.55 2.28 3.2];
+
+n = length(Y);
+M1 = [sum(X.^4) sum(X.^3) sum(X.^2); sum(X.^3) sum(X.^2) sum(X); sum(X.^2) sum(X) n];
+M2 = [sum(X.^2 .* Y); sum(X.*Y); sum(Y)];
+A = M1\M2;
+
+a = A(1);
+b = A(2);
+c = A(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 =")