%% Moving Average Model
% This example shows how to calculate and plot the impulse response function for a moving average (MA) model. The MA(q) model is given by
% {y_t} = \mu  + \theta (L){\varepsilon _t},
% where \theta(L) is a q-degree MA operator polynomial, (1 + {\theta _1}L +  \ldots  + {\theta _q}{L^q}).
% The impulse response function for an MA model is the sequence of MA coefficients, 1,{\theta _1}, \ldots ,{\theta _q}.
%% Create MA Model
% Create a zero-mean MA(3) model with coefficients \theta_1 = 0.8, \theta_2 = 0.5, and \theta_3 = -0.1.

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

%
%% Step 2. Plot the impulse response function.

impulse(Mdl)

% For an MA model, the impulse response function cuts off after q periods. For this example, the last nonzero coefficient is at lag q = 3.
% Copyright 2015 The MathWorks, Inc.