summaryrefslogtreecommitdiff
path: root/845/CH5/EX5.3/Ex5_3.sce
diff options
context:
space:
mode:
Diffstat (limited to '845/CH5/EX5.3/Ex5_3.sce')
-rwxr-xr-x845/CH5/EX5.3/Ex5_3.sce22
1 files changed, 22 insertions, 0 deletions
diff --git a/845/CH5/EX5.3/Ex5_3.sce b/845/CH5/EX5.3/Ex5_3.sce
new file mode 100755
index 000000000..fcfb407a9
--- /dev/null
+++ b/845/CH5/EX5.3/Ex5_3.sce
@@ -0,0 +1,22 @@
+//Example 5.3
+
+clc
+clear
+
+x = [8 10 15 20 30 40];
+y = [13 14 15.4 16.3 17.2 17.8];
+
+X = 1 ./x;
+Y = 1 ./y;
+
+n = length(Y);
+M1 = [sum(Y); sum(X.*Y)];
+M2 = [n sum(X); sum(X) sum(X.^2)];
+
+A = M2\M1;
+
+b = A(1);
+a = A(2);
+
+disp(round(a*10^4)/10^4, "a =")
+disp(round(b*10^4)/10^4, "b =")