function f = fitujNewtonuvZakonOteplovani(k)

T0 = 20;
T = 1000;
global tj uj

% kpresne = 1;
% 
% tj = 0:0.1:1;
% uj = T+(T0-T)*exp(-kpresne*tj);
% uj = uj + 0.05*rand(1,length(tj));

f = sum((T+(T0-T)*exp(-k*tj)-uj).*tj.*exp(-k*tj));