I would like to know the best way to extend my newly constructed sine wave fit to my data into the future another 20 days.
I have constructed a regression of 151 different sine waves to a data set across 501 days at a sample of 1 day.
y = Score(:);n = 501;t = (1:501)';games = 1:501;data(1:151) = struct('X',NaN(501,3),'bhat',NaN(3,1),'yhat',NaN);for ii = 1:151tmp = 2*pi*(sincos(ii))*t;data(ii).X = rand(501,3);data(ii).X(:,2) = cos(tmp)';data(ii).X(:,3) = sin(tmp)';data(ii).bhat = data(ii).X\y;data(ii).yhat = data(ii).bhat(1)+data(ii).bhat(2)*cos(tmp)+data(ii).bhat(3)*sin(tmp);end
After that, I have combined or superposed all of the 151 different sin waves into one sine wave
sum(horzcat(data.yhat),2) ./ 151
So ideally, I would like the combined sine wave to extend to 521 days (for a 20 day forecast) while my data set remains to be only 501 days long and plot them both. Help much appreciated!
Best Answer