1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
for i = [30 45]
p = dlmread(sprintf('products/p%03d', i), ' ');
day = p(:,3);
quantity = p(:,4);
middle = repmat(mean(p(:,4)), 42, 1);
middle_20 = repmat(mean(p(1:20, 4)), 42, 1);
[m, n] = regress(day, quantity);
f = @(x) m .* x + n;
[m, n] = regress(day(1:20), quantity(1:20));
g = @(x) m .* x + n;
figure
plot(p(:,4), "-;quantity;",
middle, "-;Mittelwert;",
middle_20, "-;Mittelwert 1-20;",
f(day), "-or;Regression 1-42;",
g(day), "-om;Regression 1-20;")
endfor
|