diff toolboxes/FullBNT-1.0.7/Kalman/convert_to_lagged_form.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/toolboxes/FullBNT-1.0.7/Kalman/convert_to_lagged_form.m	Tue Feb 10 15:05:51 2015 +0000
@@ -0,0 +1,14 @@
+function yy = convert_to_lagged_form(y, k)
+% Create an observation vector yy(:,t) containing the last k values of y, newest first
+% e.g., k=2, y = (a1 a2 a3)     yy  = a2 a3
+%                (b1 b2 b3)           b2 b2
+%                                     a1 a2
+%                                     b1 b2
+
+[s T] = size(y);
+bs = s*ones(1,k);
+yy = zeros(k*s, T-k+1);
+for i=1:k
+  yy(block(i,bs), :) = y(:, k-i+1:end-i+1);
+end
+