summaryrefslogtreecommitdiff
path: root/845/CH5/EX5.5/Ex5_5.sce
diff options
context:
space:
mode:
Diffstat (limited to '845/CH5/EX5.5/Ex5_5.sce')
-rwxr-xr-x845/CH5/EX5.5/Ex5_5.sce22
1 files changed, 22 insertions, 0 deletions
diff --git a/845/CH5/EX5.5/Ex5_5.sce b/845/CH5/EX5.5/Ex5_5.sce
new file mode 100755
index 000000000..0c5c5eccd
--- /dev/null
+++ b/845/CH5/EX5.5/Ex5_5.sce
@@ -0,0 +1,22 @@
+//Example 5.5
+
+clc
+clear
+
+x = 1:6;
+y = [2.6 5.4 8.7 12.1 16 20.2];
+
+X = x;
+Y = y ./x;
+
+n = length(Y);
+M1 = [sum(Y); sum(X.*Y)];
+M2 = [n sum(X); sum(X) sum(X.^2)];
+
+A = M2\M1;
+
+a = A(1);
+b = A(2);
+
+disp(round(a*10^5)/10^5, "a =")
+disp(round(b*10^5)/10^5, "b =")