A = [1 -1; 1 1; 1 2];
b = [7 7 21]';
coeff = inv(A'*A)*A'*b;

x = linspace(-3,3);
y = coeff(1) + coeff(2)*x;
plot(x,y,'linewidth',2); hold on;

xlabel('t');
ylabel('b');
title('18.06 PS#5, Problem 1/2');
grid on;

y2 = 7*x;
plot(x,y2,'g','linewidth',2);
legend('b = C + Dt','b = Dt');

plot([-1 1 2], [7 7 21],'ko','markersize',5);