TempExactFun = @(time)14.6*exp(-1.1*time);
timeMeasured = linspace(0,2,41);
TempMeasured = round(TempExactFun(timeMeasured));
CoefQuarticFit=polyfit(timeMeasured, TempMeasured,4);
time=0.7
exact=TempExactFun(time)
TempQuarticFit=polyval(CoefQuarticFit,time)
time=5
exact=TempExactFun(time)
TempQuarticFit=polyval(CoefQuarticFit,time)
timePlot=linspace(0,2,200);
TempExactPlot=TempExactFun(timePlot);
TempQuarticFitPlot=polyval(CoefQuarticFit,timePlot);
plot(timePlot,TempExactPlot,'--k',...
    timeMeasured,TempMeasured,'ok',...
    timePlot,TempQuarticFitPlot,'g')
errorMax=max(abs(TempQuarticFitPlot-TempExactPlot))
errorAve=sum(abs(TempQuarticFitPlot-TempExactPlot))/41
errorRMS=sqrt(sum(abs(TempQuarticFitPlot-TempExactPlot).^2)/41)
