summaryrefslogtreecommitdiff
path: root/display_data.m
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2012-05-07 21:25:07 +0200
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2012-05-07 21:25:42 +0200
commitdbe3e4d6c4f021bba19dfec6c94cd42afa94cb46 (patch)
tree934268dc7175a4859156312dc9615bf600964cf9 /display_data.m
parentad3ddb368e83fdd93426eb8d9433ecaaef526925 (diff)
downloaddmc-dbe3e4d6c4f021bba19dfec6c94cd42afa94cb46.tar.gz
dmc-dbe3e4d6c4f021bba19dfec6c94cd42afa94cb46.tar.bz2
dmc-dbe3e4d6c4f021bba19dfec6c94cd42afa94cb46.zip
display_data: Fix to calculate regression from price and quantity
Diffstat (limited to 'display_data.m')
-rw-r--r--display_data.m20
1 files changed, 7 insertions, 13 deletions
diff --git a/display_data.m b/display_data.m
index 4affa96..86ab7b5 100644
--- a/display_data.m
+++ b/display_data.m
@@ -1,7 +1,7 @@
for i = [30 45]
- p = dlmread(sprintf("products/p%03d", i), " ");
+ p = dlmread(sprintf('products/p%03d', i), ' ');
- day = p(:,1);
+ day = p(:,3);
quantity = p(:,4);
middle = repmat(mean(p(:,4)), 42, 1);
@@ -14,16 +14,10 @@ for i = [30 45]
g = @(x) m .* x + n;
figure
- plot(day, p(:,4), "-;quantity;",
- day, middle, "-;Mittelwert;",
- day, middle_20, "-;Mittelwert 1-20;",
- day, f(day), "-;Regression 1-42;",
- day, g(day), "-;Regression 1-20;")
+ plot(p(:,4), "-;quantity;",
+ middle, "-;Mittelwert;",
+ middle_20, "-;Mittelwert 1-20;",
+ f(day), "-or;Regression 1-42;",
+ g(day), "-om;Regression 1-20;")
endfor
-
-function [m, n] = regress(x, y)
- mn = [ x ones(length(x), 1) ] \ y;
- m = mn(1);
- n = mn(2);
-endfunction