%% Convert VARMA Model to VAR Model
% This example converts the polynomials of a VARMA model to a pure AR polynomial of a VAR model.
% Specify the coefficient matrices of a VARMA(3,2) model.

A1 = [.2 -.1 0;.1 .2 .05;0 .1 .3];
A2 = [.3 0 0;.1 .4 .1;0 0 .2];
A3 = [.4 .1 -.1;.2 -.5 0;.05 .05 .2];
MA1 = .2*eye(3);
MA2 = [.3 .2 .1;.2 .4 0;.1 0 .5];

%
% Convert the VARMA model matrices to a VAR model representation.

ar = arma2ar({A1 A2 A3},{MA1 MA2});

% ar is a 1-by-18 cell vector of coefficient matrices of the corresponding VAR model.
%
% Determine whether the VAR representation is stable by creating a VAR(18) model using the matrices in ar. Display the description of the model.

Mdl = varm('AR',ar);
Mdl.Description

% The VAR model representation of the VARMA model is stable.
% Copyright 2012 The MathWorks, Inc.