temp = load('temp.dat'); Temp = temp(:, 1); Time = temp(:, 2); co = cos(2*pi*Time/72); si = sin(2*pi*Time/72); lm_temp = regress(Temp, [ones(size(co)), co, si]); plot(Time, Temp, '-k', 'LineWidth', 2) hold on; plot(Time, [ones(size(co)), co, si]*lm_temp, '-b', 'LineWidth', 2) set(gca, 'Box', 'off', 'FontSize', 22, ... 'XLim', [0, 360], 'YLim', [36.6, 38.4], ... 'XTick', 0:72:288, 'YTick', 36.5:0.5:38.5, ... 'XTickLabel', 0:4, 'TickDir', 'out') cS = strcat('Temperature (', char(176), 'C)'); xlabel('Time (days)', 'FontSize', 22) ylabel(cS, 'FontSize', 22) set(gcf, 'Position', [200, 100, 1400, 600])