www.gusucode.com > econ 案例源码程序 matlab代码 > econ/CreateALagMatrixExample.m
%% Create a Lag Matrix %% % Create a bivariate time series matrix |X| with five observations each: % Copyright 2015 The MathWorks, Inc. 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.