Estimate the State-Space Equivalent of ARMAX and OE Models

This example shows how to estimate ARMAX and OE-form models using the state-space estimation approach.

You can estimate the equivalent of multiple-output ARMAX and Output-Error (OE) models using state-space model structures:

  • For an ARMAX model, specify to estimate the K matrix for the state-space model

  • For an OE model, set K = 0

Convert the resulting model into idpoly models to see them in the commonly defined ARMAX or Output-Error forms.

Load measured data.

load iddata1 z1

Estimate state-space models.

mss_noK = n4sid(z1, 2,'DisturbanceModel','none');
mss = n4sid(z1,2);

mss_noK is a second order state-space model with no disturbance model used during estimation. mss is also a second order state-space model, but with an estimated noise component. Both models use the measured data set z1 for estimation.

Convert the state-space models to polynomial models.

mOE = idpoly(mss_noK);
mARMAX = idpoly(mss);

Converting to polynomial models results in the parameter covariance information for mOE and mARMAX to be lost.

You can use one of the following to recompute the covariance:

  • Zero-iteration update using the same estimation data.

  • translatecov as a Gauss approximation formula based translation of covariance of mss_noK and mss into covariance of mOE and mARMAX.

Reestimate mOE and mARMAX for the parameters of the polynomial model using a zero iteration update.

opt = polyestOptions;
opt.SearchOption.MaxIter = 0;

mOE = polyest(z1,mOE);
mARMAX = polyest(z1,mARMAX);

The options object, opt, specifies a zero iteration update for mOE and mARMAX. Consequently, the model parameters remain unchanged and only their covariance information is updated.

Alternatively, you can use translatecov to convert the estimated models into polynomial form.

fcn = @(x)idpoly(x);
mOE = translatecov(fcn, mss_noK);
mARMAX = translatecov(fcn, mss);

Because polyest and translatecov use different computation algorithms, the covariance data obtained by running a zero-iteration update may not match that obtained using translatecov.

View the uncertainties of the model parameters.

present(mOE)
present(mARMAX)

You can use a state-space model with K = 0 (Output-Error (OE) form) for initializing a Hammerstein-Wiener estimation at the command line. This initialization may improve the fit of the model. See Using Linear Model for Hammerstein-Wiener Estimation.

For more information about ARMAX and OE models, see Identifying Input-Output Polynomial Models.

Was this topic helpful?