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

    %% Simulate and Filter  

% Copyright 2015 The MathWorks, Inc.


%% 
% Specify a mean zero ARIMA(2,0,1) model. 
Mdl = arima('Constant',0,'AR',{0.5,-0.8},'MA',-0.5,...
    'Variance',0.1);  

%% 
% Simulate the model using Monte Carlo simulation. Then, standardize the
% simulated innovations and filter them. 
rng(1); % For reproducibility
[y,e,v] = simulate(Mdl,100);
Z = e./sqrt(v);
[Y,E,V] = filter(Mdl,Z);  

%% 
% Confirm that the outputs of |simulate| and |filter| are identical. 
isequal(y,Y) 

%%
% The logical value |1| confirms the two outputs are identical.