%% Convert an MA(3) Model to an AR(5) Model
% Find the first five lag coefficients of the AR approximation of this univariate and invertible MA(3) model
% y_t = \varepsilon_t - 0.2\varepsilon_{t-1} + 0.5\varepsilon_{t-3}.
% The MA model is in difference-equation notation because the left side contains only y_t and its coefficient of 1. Create a cell vector containing the MA lag term coefficient in order starting from t - 1. Because the second lag term of the MA model is missing, specify a 0 for its coefficient.

ma0 = {-0.2 0 0.5};

%
% Convert the MA model to an AR model with at most five lag coefficients of the truncated approximation of the infinite-lag polynomial. Because there is no AR contribution, specify an empty cell ({}) for the AR coefficients.

numLags = 5;
ar0 = {}; 
ar = arma2ar(ar0,ma0,numLags)

% ar is a cell vector of scalars because at least one of ar0 and ma0 is a cell vector.
% The approximate AR(5) model is
% y_t = -0.2y_{t-1} - 0.04y_{t-2} + 0.492y_{t-3} + 0.1984y_{t-4} + 0.0597 y_{t-5} + \varepsilon_t
% Copyright 2015 The MathWorks, Inc.