summaryrefslogtreecommitdiff
path: root/sevenday_pred.m
blob: 9006c16f974e0e1535971b342217c92e6bb50599 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function pred = sevenday_pred(price, data)

	assert(mod(size(data,  1), 7) == 0);
	assert(mod(size(price, 1), 7) == 0);

	interval_count = size(data, 1) / 7;
	pred_weeks = (size(price, 1) - size(data, 1)) / 7;

	len = size(data, 1) / interval_count;
	pred = zeros(len, size(data, 2));

	for i = 0:(interval_count-1)
		pred += data(1+(len*i) : len+(len*i) , :);
	end

	pred ./= interval_count;
	pred = repmat(pred, pred_weeks, 1);
end