Accelerating the pace of engineering and science

# bj

Estimate Box-Jenkins polynomial model using time domain data

## Syntax

sys = bj(data, [nb nc nd nf nk])
sys = bj(data,[nb nc nd nf nk], Name,Value)
sys = bj(data, init_sys)
sys = bj(data, ___, opt)

## Description

sys = bj(data, [nb nc nd nf nk]) estimates a Box-Jenkins polynomial model, sys, using the time domain data, data. [nb nc nd nf nk] define the orders of the polynomials used for estimation.

sys = bj(data,[nb nc nd nf nk], Name,Value) estimates a polynomial model with additional options specified by one or more Name,Value pair arguments.

sys = bj(data, init_sys) estimates a Box-Jenkins polynomial using the polynomial model init_sys to configure the initial parameterization of sys.

sys = bj(data, ___, opt) estimates a Box-Jenkins polynomial using the option set, opt, to specify estimation behavior.

## Input Arguments

 data Estimation data. data is an iddata object containing the input and output signal values. [nb nc nd nf nk] A vector of matrices containing the orders and delays of the Box-Jenkins model. Matrices must contain nonnegative integers. nb is the order of the B polynomial plus 1 (Ny-by-Nu matrix)nc is the order of the C polynomial plus 1 (Ny-by–1 matrix)nd is the order of the D polynomial plus 1 (Ny-by-1 matrix)nf is the order of the F polynomial plus 1 (Ny-by-Nu matrix)nk is the input delay (in number of samples, Ny-by-Nu matrix) where Nu is the number of inputs and Ny is the number of outputs. opt Estimation options. opt is an options set that configures, among others, the following: estimation objectiveinitial conditionsnumerical search method to be used in estimation Use bjOptions to create the options set. init_sys Polynomial model that configures the initial parameterization of sys. init_sys must be an idpoly model with the Box-Jenkins structure that has only B, C, D and F polynomials active. bj uses the parameters and constraints defined in init_sys as the initial guess for estimating sys. Use the Structure property of init_sys to configure initial guesses and constraints for B(q), F(q), C(q) and D(q). To specify an initial guess for, say, the C(q) term of init_sys, set init_sys.Structure.c.Value as the initial guess. To specify constraints for, say, the B(q) term of init_sys: set init_sys.Structure.b.Minimum to the minimum B(q) coefficient valuesset init_sys.Structure.b.Maximum to the maximum B(q) coefficient valuesset init_sys.Structure.b.Free to indicate which B(q) coefficients are free for estimation You can similarly specify the initial guess and constraints for the other polynomials.

### Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

 'InputDelay' Input delays. InputDelay is a numeric vector specifying a time delay for each input channel. Specify input delays in integer multiples of the sampling period Ts. For example, InputDelay = 3 means a delay of three sampling periods. For a system with Nu inputs, set InputDelay to an Nu-by-1 vector, where each entry is a numerical value representing 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 for all input channels 'ioDelay' Transport delays. ioDelay is a numeric array specifying a separate transport delay for each input/output pair. Specify transport delays as integers denoting delay of a multiple of the sampling period Ts. For a MIMO system with Ny outputs and Nu inputs, set ioDelay to a Ny-by-Nu array, where each entry is a numerical value representing 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' Logical specifying integrators in the noise channel. IntegrateNoise is a logical vector of length Ny, where Ny is the number of outputs. Setting IntegrateNoise to true for a particular output results in the model: $y\left(t\right)=\frac{B\left(q\right)}{F\left(q\right)}u\left(t-nk\right)+\frac{C\left(q\right)}{D\left(q\right)}\frac{e\left(t\right)}{1-{q}^{-1}}$ Where, $\frac{1}{1-{q}^{-1}}$ is the integrator in the noise channel,e(t). Default: false(Ny,1)(Ny is the number of outputs)

## Output Arguments

 sys Identified polynomial model of Box-Jenkins structure. sys is a discrete-time idpoly model which encapsulates the identified polynomial model.

## Examples

expand all

### Identify SISO Box-Jenkins Model

Estimate the parameters of a single-input, single-output Box-Jenkins model from measured data.

```load iddata1 z1;
nb = 2;
nc = 2;
nd = 2;
nf = 2;
nk = 1;
sys = bj(z1,[nb nc nd nf nk]);
```

sys is a discrete-time idpoly model with estimated coefficients. The order of sys is as described by nb, nc, nd, nf, and nk.

Use getpvec to obtain the estimated parameters and getcov to obtain the covariance associated with the estimated parameters.

### Estimate a Multi-Input, Single-Output Box-Jenkins Model

Estimate the parameters of a multi-input, single-output Box-Jenkins model from measured data.

```load iddata8
nb = [2 1 1];
nc = 1;
nd = 1;
nf = [2 1 2];
nk = [5 10 15];
sys = bj(z8,[nb nc nd nf nk]);
```

sys estimates the parameters of a model with three inputs and one output. Each of the inputs has a delay associated with it.

### Estimate Box-Jenkins Model Using Regularization

Estimate a regularized BJ model by converting a regularized ARX model.

```load regularizationExampleData.mat m0simdata
```

Estimate an unregularized BJ model of order 30.

```m1 = bj(m0simdata(1:150), [15 15 15 15 1]);
```

Estimate a regularized BJ model by determining Lambda value by trial and error.

```opt = bjOptions;
opt.Regularization.Lambda = 1;
m2 = bj(m0simdata(1:150), [15 15 15 15 1], opt);
```

Obtain a lower-order BJ model by converting a regularized ARX model followed by order reduction.

```opt1 = arxOptions;
[L,R] = arxRegul(m0simdata(1:150), [30 30 1]);
opt1.Regularization.Lambda = L;
opt1.Regularization.R = R;
m0 = arx(m0simdata(1:150),[30 30 1],opt1);
mr = idpoly(balred(idss(m0),7));
```

Compare the model outputs against data.

```compare(m0simdata(150:end), m1, m2, mr, ...
compareOptions('InitialCondition','z'));
```

### Configure Estimation Options

Estimate the parameters of a single-input, single-output Box-Jenkins model while configuring some estimation options.

Generate estimation data.

```B = [0 1 0.5];
C = [1 -1 0.2];
D = [1 1.5 0.7];
F = [1 -1.5 0.7];
sys0 = idpoly(1,B,C,D,F,0.1);
e = iddata([],randn(200,1));
u = iddata([],idinput(200));
y = sim(sys0,[u e]);
data = [y u];
```

data is a single-input, single-output data set created by simulating a known model.

Estimate initial Box-Jenkins model.

```nb = 2;
nc = 2;
nd = 2;
nf = 2;
nk = 1;
init_sys = bj(data,[2 2 2 2 1]);
```

Create an estimation option set to refine the parameters of the estimated model.

```opt = bjOptions;
opt.Display = 'on';
opt.SearchOption.MaxIter = 50;
```

opt is an estimation option set that configures the estimation to iterate 50 times at most and display the estimation progress.

Reestimate the model parameters using the estimation option set.

```sys = bj(data,init_sys,opt);
```

sys is estimated using init_sys for the initial parameterization for the polynomial coefficients.

To view the estimation result, enter sys.Report.

### Estimate MIMO Box-Jenkins Model

Estimate a multi-input, multi-output Box-Jenkins model from estimated data.

```load iddata1 z1
data = [z1, z2(1:300)];
```

data contains the measured data for two inputs and two outputs.

Estimate the model.

```nb = [2 2; 3 4];
nc = [2;2];
nd = [2;2];
nf = [1 0; 2 2];
nk = [1 1; 0 0];
sys = bj(data, [nb nc nd nf nk]);```

The polynomial order coefficients contain one row for each output.

sys is a discrete-time idpoly model with two inputs and two outputs.

## Alternatives

To estimate a continuous-time model, use:

• tfest — returns a transfer function model

• ssest — returns a state-space model

• bj to first estimate a discrete-time model and convert it a continuous-time model using d2c.

expand all

### Box-Jenkins Model Structure

The general Box-Jenkins model structure is:

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

where nu is the number of input channels.

The orders of Box-Jenkins model are defined as follows:

## References

[1] Ljung, L. System Identification: Theory for the User, Upper Saddle River, NJ, Prentice-Hal PTR, 1999.