%% Simulate Step Response
% Assess the dynamic behavior of a system to a persistent change in a variable by plotting a step response.
% Specify a mean zero ARIMA(2,0,1) process.

Mdl = arima('Constant',0,'AR',{0.5,-0.8},'MA',-0.5,...
    'Variance',0.1);

%
% Simulate the first 20 responses to a sequence of unit disturbances. Generate a disturbance series of ones, and then filter it. Set all presample observations equal to zero.

Z = ones(20,1);
Y = filter(Mdl,Z,'Y0',zeros(Mdl.P,1));
Y = Y/Y(1);

% The last step normalizes the step response function to ensure that the first element is 1.
%
% Plot the step response function.

figure;
stem((0:numel(Y)-1)',Y,'filled');
title 'Step Response';

%
% Copyright 2015 The MathWorks, Inc.