www.gusucode.com > econ 案例源码程序 matlab代码 > econ/DifferenceLagOperatorPolynomialsExample.m

    %% Difference Lag Operator Polynomials
%% Specify a first difference polynomial

% Copyright 2015 The MathWorks, Inc.

D1 = LagOp({1,-1},'Lags',[0,1])
%% Specify a monthly differencing polynomial
D12 = LagOp({1,-1},'Lags',[0,12])
%% Create second differencing polynomial
D2 = D1*D1
%% Simulate data
rng('default')
Y = randn(10,1);
%% Filter data through second difference polynomial
Yf = filter(D2,Y);
length(Yf)
%% View the indeces of the second differenced series
[Yf,Tidx] = filter(D2,Y);
Tidx
%% Filter using shorthand syntax
Yf = D2(Y);