From d5e1b113bcab2d22260446b87ef3251f7eeb7943 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Tue, 8 May 2012 09:22:54 +0200 Subject: Add frequency removal to run_tests (bad result) --- remove_sevenday_frequency.m | 9 +++++++++ run_tests.m | 8 ++++++++ 2 files changed, 17 insertions(+) create mode 100644 remove_sevenday_frequency.m 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); -- cgit