## Estimate Models Using armax

This example shows how to estimate a linear, polynomial model with an ARMAX structure for a three-input and single-output (MISO) system using the iterative estimation method armax. For a summary of all available estimation commands in the toolbox, see Model Estimation Commands.

Load a sample data set z8 with three inputs and one output, measured at 1 -second intervals and containing 500 data samples.

Use armax to both construct the idpoly model object, and estimate the parameters:

$A\left(q\right)y\left(t\right)=\sum _{i=1}^{nu}{B}_{i}\left(q\right){u}_{i}\left(t-n{k}_{i}\right)+C\left(q\right)e\left(t\right)$

Typically, you try different model orders and compare results, ultimately choosing the simplest model that best describes the system dynamics. The following command specifies the estimation data set, z8 , and the orders of the A , B , and C polynomials as na , nb , and nc, respectively. nk of [0 0 0] specifies that there is no input delay for all three input channels.

opt = armaxOptions;
opt.Focus = 'simulation';
opt.SearchOptions.MaxIterations = 50;
opt.SearchOptions.Tolerance = 1e-5;
na = 4;
nb = [3 2 3];
nc = 4;
nk = [0 0 0];
m_armax = armax(z8, [na nb nc nk], opt);

Focus, Tolerance, and MaxIter are estimation options that configure the estimation objective function and the attributes of the search algorithm. The Focus option specifies whether the model is optimized for simulation or prediction applications. The Tolerance and MaxIter search options specify when to stop estimation. For more information about these properties, see the armaxOptions reference page.

armax is a version of polyest with simplified syntax for the ARMAX model structure. The armax method both constructs the idpoly model object and estimates its parameters.

View information about the resulting model object.

m_armax
m_armax =
Discrete-time ARMAX model: A(z)y(t) = B(z)u(t) + C(z)e(t)
A(z) = 1 - 1.284 z^-1 + 0.3048 z^-2 + 0.2648 z^-3 - 0.05708 z^-4

B1(z) = -0.07547 + 1.087 z^-1 + 0.7166 z^-2

B2(z) = 1.019 + 0.1142 z^-1

B3(z) = -0.06739 + 0.06828 z^-1 + 0.5509 z^-2

C(z) = 1 - 0.06096 z^-1 - 0.1296 z^-2 + 0.02489 z^-3 - 0.04699 z^-4

Sample time: 1 seconds

Parameterization:
Polynomial orders:   na=4   nb=[3 2 3]   nc=4   nk=[0 0 0]
Number of free coefficients: 16
Use "polydata", "getpvec", "getcov" for parameters and their uncertainties.

Status:
Estimated using ARMAX on time domain data "z8".
Fit to estimation data: 80.86% (simulation focus)
FPE: 2.888, MSE: 0.9868

m_armax is an idpoly model object. The coefficients represent estimated parameters of this polynomial model. You can use present(m_armax) to show additional information about the model, including parameter uncertainties.

View all property values for this model.

get(m_armax)
A: [1 -1.2836 0.3048 0.2648 -0.0571]
B: {[-0.0755 1.0870 0.7166]  [1.0188 0.1142]  [-0.0674 ... ]}
C: [1 -0.0610 -0.1296 0.0249 -0.0470]
D: 1
F: {[1]  [1]  [1]}
IntegrateNoise: 0
Variable: 'z^-1'
IODelay: [0 0 0]
Structure: [1x1 pmodel.polynomial]
NoiseVariance: 2.7984
InputDelay: [3x1 double]
OutputDelay: 0
InputName: {3x1 cell}
InputUnit: {3x1 cell}
InputGroup: [1x1 struct]
OutputName: {'y1'}
OutputUnit: {''}
OutputGroup: [1x1 struct]
Notes: [0x1 string]
UserData: []
Name: ''
Ts: 1
TimeUnit: 'seconds'
SamplingGrid: [1x1 struct]
Report: [1x1 idresults.polyest]

The Report model property contains detailed information on the estimation results. To view the properties and values inside Report, use dot notation. For example:

m_armax.Report
ans =
Status: 'Estimated using ARMAX with simulation focus'
Method: 'ARMAX'
InitialCondition: 'zero'
Fit: [1x1 struct]
Parameters: [1x1 struct]
OptionsUsed: [1x1 idoptions.polyest]
RandState: [1x1 struct]
DataUsed: [1x1 struct]
Termination: [1x1 struct]

This action displays the contents of estimation report such as model quality measures (Fit), search termination criterion (Termination), and a record of estimation data (DataUsed) and options (OptionsUsed).