function [u,v]=Regression_Line(t,f)
    
% function [u,v]=Regression_Line(t,f)    
% Regression Line p(t)=u+v*t to a set
% of points (t_i,f_i), i=1,...,n
    
n=length(t);
st=sum(t);
sf=sum(f);
stt=sum(t.^2);
stf=sum(t.*f);
den=n*sum(t.^2)-sum(t)^2;

u=(stt*sf-st*stf)/den;
v=(n*stf-st*sf)/den;