function x = linearregression(t,y)
% Solution of linear regression problem (fitting of a line to data) for data
% points \Blue{$(t_i,y_i)$}, \Blue{$i=1,\ldots,n$} passed in the \emph{column vectors}
% \texttt{t} and \texttt{y}. 
% The return value is a 2-vector, containing the slope of the fitted line in
% x(1) and its offset in x(2)
n = length(t); if (length(y) ~= n), error('data size mismatch'); end
% Coefficient matrix of \textbf{overdetermined linear system}
A = [t,ones(n,1)]; 
% \Red{Determine least squares solution by using MATLAB's $\backslash$-operator}
x = A\y;
