annotate 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
rev   line source
wolffd@0 1 function yy = convert_to_lagged_form(y, k)
wolffd@0 2 % Create an observation vector yy(:,t) containing the last k values of y, newest first
wolffd@0 3 % e.g., k=2, y = (a1 a2 a3) yy = a2 a3
wolffd@0 4 % (b1 b2 b3) b2 b2
wolffd@0 5 % a1 a2
wolffd@0 6 % b1 b2
wolffd@0 7
wolffd@0 8 [s T] = size(y);
wolffd@0 9 bs = s*ones(1,k);
wolffd@0 10 yy = zeros(k*s, T-k+1);
wolffd@0 11 for i=1:k
wolffd@0 12 yy(block(i,bs), :) = y(:, k-i+1:end-i+1);
wolffd@0 13 end
wolffd@0 14