iv4

ARX model estimation using four-stage instrumental variable method

Syntax

```sys = iv4(data,[na nb nk]) sys = iv4(data,'na',na,'nb',nb,'nk',nk) sys = iv4(___,Name,Value) sys = iv4(___,opt) ```

Description

```sys = iv4(data,[na nb nk])``` estimates an ARX polynomial model, `sys`, using the four-stage instrumental variable method, for the data object `data`. ```[na nb nk]``` specifies the ARX structure orders of the A and B polynomials and the input to output delay. The estimation algorithm is insensitive to the color of the noise term.

`sys` is an ARX model:

`$A\left(q\right)y\left(t\right)=B\left(q\right)u\left(t-nk\right)+v\left(t\right)$`

`sys = iv4(data,'na',na,'nb',nb,'nk',nk)` alternatively specify the ARX model orders separately.

`sys = iv4(___,Name,Value)` estimates an ARX polynomial with additional options specified by one or more `Name,Value` pair arguments.

`sys = iv4(___,opt)` uses the option set, `opt`, to configure the estimation behavior.

Input Arguments

 `data` Estimation data. The data can be: Time- or frequency-domain input-output dataTime-series dataFrequency-response data `data` must be an `iddata`, `idfrd`, or `frd` (Control System Toolbox) object. `data` must be discrete-time (Ts>0) for frequency domain. `[na nb nk]` ARX polynomial orders. For multi-output model, `[na nb nk]` contains one row for every output. In particular, specify `na` as an Ny-by-Ny matrix, where each entry is the polynomial order relating the corresponding output pair. Here, Ny is the number of outputs. Specify `nb` and `nk` as Ny-by-Nu matrices, where Nu is the number of inputs. For more details on the ARX model structure, see `arx`. `opt` Estimation options. `opt` is an options set that configures the estimation options. These options include: estimation focushandling of initial conditionshandling of data offsets Use `iv4Options` to create the options set.

Name-Value Arguments

Specify optional pairs of arguments as `Name1=Value1,...,NameN=ValueN`, where `Name` is the argument name and `Value` is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose `Name` in quotes.

 `InputDelay` Input delay for each input channel, specified as a scalar value or numeric vector. For continuous-time systems, specify input delays in the time unit stored in the `TimeUnit` property. For discrete-time systems, specify input delays in integer multiples of the sample time `Ts`. For example, ```InputDelay = 3``` means a delay of three sample times. For a system with `Nu` inputs, set `InputDelay` to an `Nu`-by-1 vector. Each entry of this vector is a numerical value that represents the input delay for the corresponding input channel. You can also set `InputDelay` to a scalar value to apply the same delay to all channels. Default: 0 `IODelay` Transport delays. `IODelay` is a numeric array specifying a separate transport delay for each input/output pair. For continuous-time systems, specify transport delays in the time unit stored in the `TimeUnit` property. For discrete-time systems, specify transport delays in integer multiples of the sample time, `Ts`. For a MIMO system with `Ny` outputs and `Nu` inputs, set `IODelay` to a `Ny`-by-`Nu` array. Each entry of this array is a numerical value that represents the transport delay for the corresponding input/output pair. You can also set `IODelay` to a scalar value to apply the same delay to all input/output pairs. Default: `0` for all input/output pairs `IntegrateNoise` Specify integrators in the noise channels. Adding an integrator creates an ARIX model represented by: `$A\left(q\right)y\left(t\right)=B\left(q\right)u\left(t-nk\right)+\frac{1}{1-{q}^{-1}}e\left(t\right)$` where,$\frac{1}{1-{q}^{-1}}$ is the integrator in the noise channel, e(t). `IntegrateNoise` is a logical vector of length `Ny`, where `Ny` is the number of outputs. Default: `false(Ny,1)`, where `Ny` is the number of outputs

Output Arguments

`sys`

ARX model that fits the estimation data, returned as a discrete-time `idpoly` object. This model is created using the specified model orders, delays, and estimation options.

Information about the estimation results and options used is stored in the `Report` property of the model. `Report` has the following fields:

Report FieldDescription
`Status`

Summary of the model status, which indicates whether the model was created by construction or obtained by estimation.

`Method`

Estimation command used.

`InitialCondition`

Handling of initial conditions during model estimation, returned as one of the following values:

• `'zero'` — The initial conditions were set to zero.

• `'estimate'` — The initial conditions were treated as independent estimation parameters.

This field is especially useful to view how the initial conditions were handled when the `InitialCondition` option in the estimation option set is `'auto'`.

`Fit`

Quantitative assessment of the estimation, returned as a structure. See Loss Function and Model Quality Metrics for more information on these quality metrics. The structure has the following fields:

FieldDescription
`FitPercent`

Normalized root mean squared error (NRMSE) measure of how well the response of the model fits the estimation data, expressed as the percentage fitpercent = 100(1-NRMSE).

`LossFcn`

Value of the loss function when the estimation completes.

`MSE`

Mean squared error (MSE) measure of how well the response of the model fits the estimation data.

`FPE`

Final prediction error for the model.

`AIC`

Raw Akaike Information Criteria (AIC) measure of model quality.

`AICc`

Small-sample-size corrected AIC.

`nAIC`

Normalized AIC.

`BIC`

Bayesian Information Criteria (BIC).

`Parameters`

Estimated values of model parameters.

`OptionsUsed`

Option set used for estimation. If no custom options were configured, this is a set of default options. See `iv4Options` for more information.

`RandState`

State of the random number stream at the start of estimation. Empty, `[]`, if randomization was not used during estimation. For more information, see `rng`.

`DataUsed`

Attributes of the data used for estimation, returned as a structure with the following fields.

FieldDescription
`Name`

Name of the data set.

`Type`

Data type.

`Length`

Number of data samples.

`Ts`

Sample time.

`InterSample`

Input intersample behavior, returned as one of the following values:

• `'zoh'` — Zero-order hold maintains a piecewise-constant input signal between samples.

• `'foh'` — First-order hold maintains a piecewise-linear input signal between samples.

• `'bl'` — Band-limited behavior specifies that the continuous-time input signal has zero power above the Nyquist frequency.

`InputOffset`

Offset removed from time-domain input data during estimation. For nonlinear models, it is `[]`.

`OutputOffset`

Offset removed from time-domain output data during estimation. For nonlinear models, it is `[]`.

For more information on using `Report`, see Estimation Report.

Examples

collapse all

`load iddata7;`

This data has two inputs, `u1` and `u2`, and one output, `y1`.

Specify the ARX model orders, using the same orders for both inputs.

```na = 2; nb = [2 2];```

Specify a delay of `2` samples for input `u2` and no delay for input `u1`.

`nk = [0 2];`

Estimate an ARX model using the four-stage instrumental variable method.

`m = iv4(z7,[na nb nk]);`

Algorithms

Estimation is performed in 4 stages. The first stage uses the `arx` function. The resulting model generates the instruments for a second-stage IV estimate. The residuals obtained from this model are modeled as a high-order AR model. At the fourth stage, the input-output data is filtered through this AR model and then subjected to the IV function with the same instrument filters as in the second stage.

For the multiple-output case, optimal instruments are obtained only if the noise sources at the different outputs have the same color. The estimates obtained with the routine are reasonably accurate, however, even in other cases.

References

[1] Ljung, L. System Identification: Theory for the User, equations (15.21) through (15.26), Upper Saddle River, NJ, Prentice-Hall PTR, 1999.

Version History

Introduced before R2006a