%% Create a Lag Matrix
% Create a bivariate time series matrix X with five observations each:

X = [1 -1; 2 -2 ;3 -3 ;4 -4 ;5 -5]  % Create a simple
                                    % bivariate series.

%
% Create a lagged matrix XLAG, composed of X and the first two lags of X:

XLAG = lagmatrix(X,[0 1 2]) % Create the lagged matrix.

% The result, XLAG, is a 5-by-6 matrix.
% Copyright 2015 The MathWorks, Inc.