summaryrefslogtreecommitdiff
path: root/845/CH5/EX5.7/Ex5_7.sce
diff options
context:
space:
mode:
Diffstat (limited to '845/CH5/EX5.7/Ex5_7.sce')
-rwxr-xr-x845/CH5/EX5.7/Ex5_7.sce22
1 files changed, 22 insertions, 0 deletions
diff --git a/845/CH5/EX5.7/Ex5_7.sce b/845/CH5/EX5.7/Ex5_7.sce
new file mode 100755
index 000000000..f5eb5968b
--- /dev/null
+++ b/845/CH5/EX5.7/Ex5_7.sce
@@ -0,0 +1,22 @@
+//Example 5.7
+
+clc
+clear
+
+x = 2:5;
+y = [27.8 62.1 110 161];
+
+X = log(x);
+Y = log(y);
+
+n = length(Y);
+M1 = [sum(X.^2) sum(X); sum(X) n];
+M2 = [sum(X.*Y); sum(Y)];
+M = M1\M2;
+
+b = M(1);
+A = M(2);
+a = exp(A);
+
+disp(round(a*10^4)/10^4, "a =")
+disp(round(b*10^4)/10^4, "b =")