summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2012-05-08 09:22:54 +0200
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2012-05-08 09:24:06 +0200
commitd5e1b113bcab2d22260446b87ef3251f7eeb7943 (patch)
treeaa35515ecbbdf9e7fdb0cd829f0f58d7f9187846
parent78e6538f5e37a7b1542ae8f4e72f7168bec09c67 (diff)
downloaddmc-d5e1b113bcab2d22260446b87ef3251f7eeb7943.tar.gz
dmc-d5e1b113bcab2d22260446b87ef3251f7eeb7943.tar.bz2
dmc-d5e1b113bcab2d22260446b87ef3251f7eeb7943.zip
Add frequency removal to run_tests (bad result)
-rw-r--r--remove_sevenday_frequency.m9
-rw-r--r--run_tests.m8
2 files changed, 17 insertions, 0 deletions
diff --git a/remove_sevenday_frequency.m b/remove_sevenday_frequency.m
new file mode 100644
index 0000000..e0233cc
--- /dev/null
+++ b/remove_sevenday_frequency.m
@@ -0,0 +1,9 @@
+function [ret, removed] = remove_sevenday_frequency(quantity)
+ A = fft(sum(quantity'));
+ kickout = (abs(A) > 2500) .* (abs(A) < 20000);
+
+ f = fft(quantity);
+ removed = diag(kickout) * f;
+ ret = real(ifft(diag(1-kickout) * f));
+end
+
diff --git a/run_tests.m b/run_tests.m
index 32e49cb..aecacd5 100644
--- a/run_tests.m
+++ b/run_tests.m
@@ -7,3 +7,11 @@
calc_error('mean', q(29:42, :), mean_pred(q(1:28, :), 14));
calc_error('regress', q(29:42, :), regress_pred(p, q(1:28, :)));
calc_error('sevenday', q(29:42, :), repmat(sevenday_pred(q(1:28, :), 4), 2, 1));
+
+[q2, removed] = remove_sevenday_frequency(q(1:14, :));
+tmp = regress_pred(p([1:14 29:42],:), q2);
+tmp = fft(tmp);
+%tmp = (tmp .* (removed == 0)) + removed;
+tmp = tmp + removed;
+tmp = real(ifft(tmp));
+calc_error('regress2', q(29:42, :), tmp);