Main Content

Estimate 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 models into idpoly models to see them in the commonly defined ARMAX or OE 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.SearchOptions.MaxIterations = 0;

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

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);
mOEt = translatecov(fcn,mss_noK);
mARMAXt = 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.

You can view the uncertainties of the model parameters using present(mOE) and 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 Initialize Hammerstein-Wiener Estimation Using Linear Model.

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