# idssdata

State-space data of identified system

## Syntax

```[A,B,C,D,K] = idssdata(sys) [A,B,C,D,K,x0] = idssdata(sys) [A,B,C,D,K,x0,dA,dB,dC,dD,dK,dx0] = idssdata(sys) [A,B,C,D,K,___] = idssdata(sys,j1,...,jN) [A,B,C,D,K,___] = idssdata(sys,'cell') ```

## Description

```[A,B,C,D,K] = idssdata(sys)``` returns the A,B,C,D and K matrices of the identified state-space model `sys`.

`[A,B,C,D,K,x0] = idssdata(sys)` returns the initial state values, `x0`.

`[A,B,C,D,K,x0,dA,dB,dC,dD,dK,dx0] = idssdata(sys)` returns the uncertainties in the system matrices for `sys`.

```[A,B,C,D,K,___] = idssdata(sys,j1,...,jN)``` returns data for the `j1, ..., jn` entries in the model array `sys`.

```[A,B,C,D,K,___] = idssdata(sys,'cell')``` returns data for all the entries in the model array `sys` as separate cells in cell arrays.

## Input Arguments

 `sys` Identified model. If `sys` is not an identified state-space model (`idss` or `idgrey`), then it is first converted to an `idss` model. This conversion results in a loss of the model uncertainty information. `sys` can be an array of identified models. `j1,...,jN` Integer indices of N entries in the array `sys` of identified systems.

## Output Arguments

 `A,B,C,D,K` State-space matrices that represent `sys` as: `$\begin{array}{l}x\left[k+1\right]=Ax\left[k\right]+Bu\left[k\right]+Ke\left[k\right];x\left[0\right]=x0;\\ y\left[k\right]=Cx\left[k\right]+Du\left[k\right]+e\left[k\right];\end{array}$` If `sys` is an array of identified models, then `A,B,C,D,K` are multi-dimension arrays. To access the state-space matrix, say A, for the k-th entry of `sys`, use `A(:,:,k)`. `x0` Initial state. If `sys` is an `idss` or `idgrey` model, then `x0` is the value obtained during estimation. It is also stored using the `Report.Parameters` property of `sys`. For other model types, `x0` is zero. If `sys` is an array of identified models, then `x0` contains a column for each entry in `sys`. `dA,dB,dC,dD,dK` Uncertainties associated with the state-space matrices `A,B,C,D,K`. The uncertainty matrices represents 1 standard deviation of uncertainty. If `sys` is an array of identified models, then `dA,dB,dC,dD,dK` are multi-dimension arrays. To access the state-space matrix, say A, for the k-th entry of `sys`, use `A(:,:,k)`. `dx0` Uncertainty associated with the initial state. `dx0` represents 1 standard deviation of uncertainty. If `sys` is an array of identified models, then `dx0` contains a column for each entry in `sys`.

## Examples

collapse all

Obtain the identified state-space matrices for a model estimated from data.

Identify a model using data.

```load icEngine.mat data = iddata(y,u,0.04); sys = n4sid(data,4,'InputDelay',2);```

`data` is an `iddata` object representing data sampled at a sampling rate of 0.04 seconds.

`sys` is an `idss` model representing the identified system.

Obtain identified state-space matrices of `sys`.

`[A,B,C,D,K] = idssdata(sys);`

Obtain the initial state associated with an identified model.

Identify a model using data.

```load icEngine.mat data = iddata(y,u,0.04); sys = n4sid(data,4,'InputDelay',2);```

`data` is an `iddata` object representing data sampled at a sampling rate of 0.04 seconds.

`sys` is an `idss` model representing the identified system.

Obtain the initial state associated with `sys`.

`[A,B,C,D,K,x0] = idssdata(sys);`

`A`, `B`, `C`, `D` and `K` represent the state-space matrices of the identified model `sys`. `x0` is the initial state identified for `sys`.

Obtain the uncertainty matrices of the state-space matrices of an identified model.

Identify a model using data.

```load icEngine.mat data = iddata(y,u,0.04); sys = n4sid(data,4,'InputDelay',2);```

`data` is an `iddata` object representing data sampled at a sampling rate of 0.04 seconds.

`sys` is an `idss` model representing the identified system.

Obtain the uncertainty matrices associated with the state-space matrices of `sys`.

`[A,B,C,D,K,x0,dA,dB,dC,dD,dx0] = idssdata(sys);`

`dA`, `dB`, `dC`, `dD` and `dK` represent the uncertainty associated with the state-space matrices of the identified model `sys`. `dx0` represents the uncertainty associated with the estimated initial state.

Obtain the state-space matrices for multiple models from an array of identified models.

Identify multiple models using data.

```load icEngine.mat data = iddata(y,u,0.04); sys2 = n4sid(data,2,'InputDelay',2); sys3 = n4sid(data,3,'InputDelay',2); sys4 = n4sid(data,4,'InputDelay',2); sys = stack(1,sys2,sys3,sys4);```

`data` is an `iddata` object representing data sampled at a sampling rate of 0.04 seconds.

`sys` is an array of `idss` models. The first entry of `sys` is a second-order identified system. The second and third entries of `sys` are third- and fourth-order identified systems, respectively.

Obtain the state-space matrices for the first and third entries of `sys`.

```[A,B,C,D,K,x0] = idssdata(sys,1); [A,B,C,D,K,x0] = idssdata(sys,3);```

Obtain the state-space matrices of an array of identified models in cell arrays.

Identify multiple models using data.

```load icEngine.mat data = iddata(y,u,0.04); sys3 = n4sid(data,3,'InputDelay',2); sys4 = n4sid(data,4,'InputDelay',2); sys = stack(1,sys3,sys4);```

`data` is an `iddata` object representing data sampled at a sampling rate of 0.04 seconds.

`sys` is an array of `idss` models. The first entry of `sys` is a third-order identified system and the second entry is a fourth-order identified system.

Obtain the state-space matrices of `sys` in cell arrays.

`[A,B,C,D,K,x0] = idssdata(sys,'cell');`

`A`, `B`, `C`, `D` and `K` are cell arrays containing the state-space matrices of the individual entries of the identified model array `sys`. `x0` is a cell array containing the estimated initial state of the individual entries of the identified model array `sys`.