A = [2 	, 87;
3 	, 96;
4 	, 103;
5 	,110;
6 	,116;
7 	,122;
8 	,127;
9 	,133;
10 	,137;
11 	,143;
12 	,149;
13 	,156;
14 	,163;
15 	,169;
16 	,173;
17 	,175;
18 	,176];

x = A(:,1);
y = A(:,2);

% look at the data
scatter(x, y, 'filled');
hold on
xlabel('age (years)');
ylabel('height (cm)');

% model y = ax+b
A = [x, x.^0];
b = y;
c = (A'*A)\(A'*b);
x2 = linspace(0, 20, 1001);
y2 = polyval(c, x2);

plot(x2, y2, 'LineWidth', 3);

% model y = cubic function
A = [x.^3, x.^2, x, x.^0];
b = y;
c = (A'*A)\(A'*b);
x2 = linspace(0, 20, 1001);
y2 = polyval(c, x2);

plot(x2, y2, 'LineWidth', 3);

