summaryrefslogtreecommitdiff
path: root/845/CH5/EX5.1/Ex5_1.sce
blob: 4c3cbaf8cf2d54e72e89ee652931f28c324d1462 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//Example 5.1
clc
clear

x = 10:10:80;
y = [1.06 1.33 1.52 1.68 1.81 1.91 2.01 2.11];

X = log(x);
Y = log(y);

n = length(Y);
M1 = [sum(Y); sum(X.*Y)];
M2 = [n sum(X); sum(X) sum(X.^2)];

A = M2\M1;

m = exp(A(1));
n = A(2);

disp(round(m*10^4)/10^4, "m =")
disp(round(n*10^4)/10^4, "n =")