summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Klemkow <j.klemkow@wemelug.de>2012-04-24 13:39:06 +0200
committerJan Klemkow <j.klemkow@wemelug.de>2012-04-24 13:39:47 +0200
commit2b942568d54cffa4524e897c0f18c0db81459186 (patch)
tree6de12ed64f1d56eef70fc31bfbf8f1f616fab96e
parentffefc1facb2c5eb3fe08bfaadf8dc29681910424 (diff)
downloaddmc-2b942568d54cffa4524e897c0f18c0db81459186.tar.gz
dmc-2b942568d54cffa4524e897c0f18c0db81459186.tar.bz2
dmc-2b942568d54cffa4524e897c0f18c0db81459186.zip
Add mean prediction test
-rw-r--r--mean_pred.m5
-rw-r--r--quad_error.m5
-rw-r--r--run_tests.m1
3 files changed, 11 insertions, 0 deletions
diff --git a/mean_pred.m b/mean_pred.m
new file mode 100644
index 0000000..bc0edd0
--- /dev/null
+++ b/mean_pred.m
@@ -0,0 +1,5 @@
+function pred_mat = mean_pred(data, days)
+
+ pred_mat = repmat(mean(data), days, 1);
+
+endfunction
diff --git a/quad_error.m b/quad_error.m
new file mode 100644
index 0000000..bdf327b
--- /dev/null
+++ b/quad_error.m
@@ -0,0 +1,5 @@
+function err = quad_error(a, b)
+
+ err = sqrt(sum(sum((a - b) .^ 2)));
+
+endfunction
diff --git a/run_tests.m b/run_tests.m
new file mode 100644
index 0000000..6b284f2
--- /dev/null
+++ b/run_tests.m
@@ -0,0 +1 @@
+meanerr = quad_error(q(29:42, :), mean_pred(q(1:28, :), 14))