# idssdata

State-space data for 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] = idssdata(sys)``
``[A,B,C,D,K,x0,dA,dB,dC,dD,dK,dx0] = idssdata(sys)``
``````[___] = idssdata(sys,j1,...,jN)``````
``````[___] = idssdata(sys,'cell')``````

## Description

``````[A,B,C,D,K] = idssdata(sys)``` returns the `A`, `B`, `C`, `D`, and `K` state-space matrices for the identified model `sys`. If `sys` is not an `idss` or `idgrey` model, then it is first converted to an `idss` model.```

example

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

example

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

example

``````[___] = idssdata(sys,j1,...,jN)``` returns data for the `j1,...,jN` entries in the model array `sys`. Use this syntax when `sys` is a model array.```

example

``````[___] = idssdata(sys,'cell')``` returns data for all the entries in the model array `sys` as separate cells in cell arrays. Use this syntax when `sys` is a model array.```

example

## 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`.

## Input Arguments

collapse all

Identified linear model, specified as one of the following model objects.

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.

Model array indices, specified as integers. Specify up to N indices, where N is the number of models in `sys`.

## Output Arguments

collapse all

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 and you do not specify the `'cell'` input option, then `A`, `B`, `C`, `D`, and `K` are multi-dimensional arrays. To access a state-space matrix, such as `A`, for the ith entry in `sys`, use `A(:,:,i)`.

If `sys` is an array of identified models and you specify the `'cell'` input option, then `A`, `B`, `C`, `D`, and `K` are cell arrays with one entry for each model in `sys`.

Initial states, returned as a column vector or array.

If `sys` is an `idss` or `idgrey` model, then `x0` contains the initial state values obtained during estimation. These values are stored in the `Report.Parameters` property of `sys`.

For other model types, `x0` is zero.

If `sys` is an array of identified models and you do not specify the `'cell'` input option, then `x0` contains one column for each entry in `sys`.

If `sys` is an array of identified models and you specify the `'cell'` input option, then `x0` is a cell array with one entry for each model in `sys`.

Uncertainties associated with the state-space matrices `A`, `B`, `C`, `D`, and `K`. The uncertainty matrices represent one standard deviation of uncertainty.

If `sys` is an array of identified models, then `dA`, `dB`, `dC`, `dD`, and `dK` are multi-dimensional arrays. To access the state-space matrix, say A, for the k-th entry of `sys`, use `A(:,:,k)`.

If `sys` is an array of identified models and you do not specify the `'cell'` input option, then `dA`, `dB`, `dC`, `dD`, and `dK` are multi-dimensional arrays. To access a state-space matrix, such as `dA`, for the ith entry in `sys`, use `dA(:,:,i)`.

If `sys` is an array of identified models and you specify the `'cell'` input option, then `dA`, `dB`, `dC`, `dD`, and `dK` are cell arrays with one entry for each model in `sys`.

Uncertainty associated with the initial states, returned as a column vector or array. `dx0` represents one standard deviation of uncertainty.

If `sys` is an array of identified models and you do not specify the `'cell'` input option, then `dx0` contains one column for each entry in `sys`.

If `sys` is an array of identified models and you specify the `'cell'` input option, then `dx0` is a cell array with one entry for each model in `sys`.

## Version History

Introduced in R2012a