Documentation

### This is machine translation

Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

# idss

State-space model with identifiable parameters

## Syntax

``sys = idss(A,B,C,D)``
``sys = idss(A,B,C,D,K)``
``sys = idss(A,B,C,D,K,x0)``
``sys = idss(A,B,C,D,K,x0,Ts)``
``sys = idss(___,Name,Value)``
``sys = idss(sys0)``
``sys = idss(sys0,'split')``

## Description

````sys = idss(A,B,C,D)` creates a state-space model with identifiable parameters. `A`, `B`, `C`, and `D` are the initial values of the state-space matrices. By default, `sys` is discrete-time model with unspecified sample time and no state disturbance element.```
````sys = idss(A,B,C,D,K)` creates a state-space model with a disturbance element given by the matrix `K`.```
````sys = idss(A,B,C,D,K,x0)` creates a state-space model with initial state values given by the vector `x0`.```
````sys = idss(A,B,C,D,K,x0,Ts)` creates a state-space model with sample time `Ts`. Use ```Ts = 0``` to create a continuous-time model.```
````sys = idss(___,Name,Value)` creates a state-space model using additional options specified by one or more `Name,Value` pair arguments. ```
````sys = idss(sys0)` converts any dynamic system model, `sys0`, to `idss` model form.```
````sys = idss(sys0,'split')` converts `sys0` to `idss` model form, and treats the last Ny input channels of `sys0` as noise channels in the returned model. `sys0` must be a numeric (non-identified) `tf`, `zpk`, or `ss` model object. Also, `sys0` must have at least as many inputs as outputs. ```

## Object Description

An `idss` model represents a system as a continuous-time or discrete-time state-space model with identifiable (estimable) coefficients.

A state-space model of a system with input vector u, output vector y, and disturbance e takes the following form in continuous time:

`$\begin{array}{c}\frac{dx\left(t\right)}{dt}=Ax\left(t\right)+Bu\left(t\right)+Ke\left(t\right)\\ y\left(t\right)=Cx\left(t\right)+Du\left(t\right)+e\left(t\right).\end{array}$`

In discrete time, the state-space model takes the form:

`$\begin{array}{c}x\left[k+1\right]=Ax\left[k\right]+Bu\left[k\right]+Ke\left[k\right]\\ y\left[k\right]=Cx\left[k\right]+Du\left[k\right]+e\left[k\right].\end{array}$`

For `idss` models, the elements of the state-space matrices A, B, C, and D can be estimable parameters. The elements of the state disturbance K can also be estimable parameters. The `idss` model stores the values of these matrix elements in the `A`, `B`, `C`, `D`, and `K` properties of the model.

There are three ways to obtain an `idss` model.

• Estimate the `idss` model based on input-output measurements of a system, using `n4sid` or `ssest`. These estimation commands estimate the values of the estimable elements of the state-space matrices. The estimated values are stored in the `A`, `B`, `C`, `D`, and `K` properties of the resulting `idss` model. The `Report` property of the resulting model stores information about the estimation, such as handling of initial state values and options used in estimation.

When you obtain an `idss` model by estimation, you can extract estimated coefficients and their uncertainties from the model using commands such as `idssdata`, `getpar`, or `getcov`.

• Create an `idss` model using the `idss` command.

You can create an `idss` model to configure an initial parameterization for estimation of a state-space model to fit measured response data. When you do so, you can specify constraints on one or more of the state-space matrix elements. For example, you can fix the values of some elements, or specify minimum or maximum values for the free elements. You can then use the configured model as an input argument to an estimation command (`n4sid` or `ssest`) to estimate parameter values with those constraints.

• Convert an existing dynamic system model to an `idss` model using the `idss` command.

To configure an `idss` model in a desired form, such as a companion or modal form, use state transformation commands such as `canon` and `ss2ss`.

## Examples

collapse all

Create a 4th-order SISO state-space model with identifiable parameters. Initialize the initial state values to 0.1 for all entries. Set the sample time to 0.1 s as well.

```A = blkdiag([-0.1 0.4; -0.4 -0.1],[-1 5; -5 -1]); B = [1; zeros(3,1)]; C = [1 0 1 0]; D = 0; K = zeros(4,1); x0 = [0.1,0.1,0.1,0.1]; Ts = 0.1; sys = idss(A,B,C,D,K,x0,Ts);```

`sys` is a 4th-order, SISO `idss` model. The number of states and input-output dimensions are determined by the dimensions of the state-space matrices. By default, all entries in the matrices `A`, `B`, `C`, `D`, and `K` are identifiable parameters.

You can use `sys` to specify an initial parametrization for state-space model estimation with `ssest` or `n4sid`.

Create a 4th-order SISO state-space model with identifiable parameters. Name the input and output channels of the model, and specify minutes for the model time units.

You can use `Name,Value` pair arguments to specify additional model properties on model creation.

```A = blkdiag([-0.1 0.4; -0.4 -0.1],[-1 5; -5 -1]); B = [1; zeros(3,1)]; C = [1 0 1 0]; D = 0; sys = idss(A,B,C,D,'InputName','Drive','TimeUnit','minutes');```

To change or specify most attributes of an existing model, you can use dot notation. For example:

`sys.OutputName = 'Torque';`

Configure an `idss` model so that it has no state disturbance element and only the non-zero entries of the `A` matrix are estimable. Additionally, fix the values of the `B` matrix.

You can configure individual parameters of an `idss` model to specify constraints for state-space model estimation with `ssest` or `n4sid`.

Create an `idss` model.

```A = blkdiag([-0.1 0.4; -0.4 -0.1],[-1 5; -5 -1]); B = [1; zeros(3,1)]; C = [1 0 1 0]; D = 0; K = zeros(4,1); x0 = [0.1,0.1,0.1,0.1]; sys = idss(A,B,C,D,K,x0,0);```

Setting all entries of `K = 0` creates an `idss` model with no state disturbance element.

Use the `Structure` property of the model to fix the values of some of the parameters.

```sys.Structure.A.Free = (A~=0); sys.Structure.B.Free = false; sys.Structure.K.Free = false;```

The entries in `sys.Structure.A.Free` determine whether the corresponding entries in `sys.A` are free (identifiable) or fixed. The first line sets `sys.Structure.A.Free` to a logical matrix that is `true` wherever `A` is non-zero, and `false` everywhere else. Doing so fixes the value of the zero entries in `sys.A`.

The remaining lines fix all the values in `sys.B` and `sys.K` to the values you specified when you created the model.

Create an array of state-space models.

There are several ways to create arrays of state-space models:

• Direct array construction using $n$-dimensional state-space arrays

• Array-building by indexed assignment

• Array-building using the `stack` command

• Sampling an identified model using the `rsample` command

Create an array by providing $n$-dimensional arrays as an input argument to `idss`, instead of 2-dimensional matrices.

```A = rand(2,2,3,4); sysarr = idss(A,[2;1],[1 1],0);```

When you provide a multi-dimensional array to `idss` in place of one of the state-space matrices, the first two dimensions specify the numbers of states, inputs, or outputs of each model in the array. The remaining dimensions specify the dimensions of the array itself. `A` is a 2-by-2-by-3-by-4 array. Therefore, `sysarr` is a 3-by-4 array of `idss` models. Each model in `sysarr` has two states, specified by the first two dimensions of `A`. Further, each model in `sysarr` has the same `B`, `C`, and `D` values.

Create an array by indexed assignment.

```sysarr = idss(zeros(1,1,2)); sysarr(:,:,1) = idss([4 -3; -2 0],[2;1],[1 1],0); sysarr(:,:,2) = idss(rand(2),rand(2,1),rand(1,2),1);```

The first command preallocates the array. The first two dimensions of the array are the I/O dimensions of each model in the array. Therefore, `sysarr` is a 2-element vector of SISO models.

The remaining commands assign an `idss` model to each position in `sysarr`. Each model in an array must have the same I/O dimensions.

Add another model to `sysarr` using `stack`.

`stack` is an alternative to building an array by indexing.

`sysarr = stack(1,sysarr,idss([1 -2; -4 9],[0;-1],[1 1],0));`

This command adds another `idss` model along the first array dimension of `sysarr`. `sysarr` is now a 3-by-1 array of SISO `idss` models

## Input Arguments

 `A,B,C,D` Initial values of the state-space matrices. For a system with Ny outputs, Nu inputs, and Nx states, specify initial values of the state-space matrix elements as follows: `A` — Nx-by-Nx matrix.`B` — Nx-by-Nu matrix.`C` — Ny-by-Nx matrix.`D` — Ny-by-Nu matrix. Use `NaN` for any matrix element whose initial value is not known. `K` Initial value of the state disturbance matrix. Specify `K` as an Nx-by-Ny matrix. Use `NaN` for any matrix element whose initial value is not known. Default: Nx-by-Ny zero matrix. `x0` Initial state values. Specify the initial condition as a column vector of Nx values. Default: Nx column vector of zeros. `Ts` Sample time. For continuous-time models, `Ts = 0`. For discrete-time models, `Ts` is a positive scalar representing the sampling period expressed in the unit specified by the `TimeUnit` property of the model. To denote a discrete-time model with unspecified sample time, set ```Ts = -1```. Default: –1 (discrete-time model with unspecified sample time) `sys0` Dynamic system. Any dynamic system to convert to an `idss` model: When `sys0` is an identified model, its estimated parameter covariance is lost during conversion. If you want to translate the estimated parameter covariance during the conversion, use `translatecov`.When `sys0` is a numeric (non-identified) model, the state-space data of `sys0` define the `A`, `B`, `C`, and `D` matrices of the converted model. The disturbance matrix `K` is fixed to zero. The `NoiseVariance` value defaults to `eye(Ny)`, where `Ny` is the number of outputs of `sys`. For the syntax `sys = idss(sys0,'split')`, `sys0` must be a numeric (non-identified) `tf`, `zpk`, or `ss` model object. Also, `sys0` must have at least as many inputs as outputs. Finally, the subsystem `sys0(:,Ny+1:Ny+Nu)` must contain a non-zero feedthrough term (the subsystem must be biproper).

### 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 quotes. You can specify several name and value pair arguments in any order as `Name1,Value1,...,NameN,ValueN`.

Use `Name,Value` arguments to specify additional properties of `idss` models during model creation. For example, `idss(A,B,C,D,'InputName','Voltage')` creates an `idss` model with the `InputName` property set to `Voltage`.

## Properties

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

`idss` object properties include:

 `A,B,C,D` Values of state-space matrices. `A` — State matrix A, an Nx-by-Nx matrix.`B` — Nx-by-Nu matrix.`C` — Ny-by-Nx matrix.`D` — Ny-by-Nu matrix. If you create an `idss` model `sys` using the `idss` command, `sys.A`, `sys.B`, `sys.C`, and `sys.D` contain the initial values of the state-space matrices that you specify with the `A,B,C,D` input arguments. If you obtain an `idss` model `sys` by identification using `ssest` or `n4sid`, then `sys.A`, `sys.B`, `sys.C`, and `sys.D` contain the estimated values of the matrix elements. For an `idss` model `sys`, each property `sys.A`, `sys.B`, `sys.C`, and `sys.D` is an alias to the corresponding `Value` entry in the `Structure` property of `sys`. For example, `sys.A` is an alias to the value of the property `sys.Structure.A.Value`. `K` Value of state disturbance matrix K, an Nx-by-Ny matrix. If you create an `idss` model `sys` using the `idss` command, `sys.K` contains the initial values of the state-space matrices that you specify with the `K` input argument. If you obtain an `idss` model `sys` by identification using `ssest` or `n4sid`, then `sys.K` contains the estimated values of the matrix elements. For an `idss` model `sys`, `sys.K` is an alias to the value of the property `sys.Structure.K.Value`. Default: Nx-by-Ny zero matrix. `StateName` State names, specified as one of the following: Character vector — For first-order models, for example, `'velocity'`.Cell array of character vectors — For models with two or more states`''` — For unnamed states. Default: `''` for all states `StateUnit` State units, specified as one of the following: Character vector — For first-order models, for example, `'velocity'`Cell array of character vectors — For models with two or more states`''` — For states without specified units Use `StateUnit` to keep track of the units each state is expressed in. `StateUnit` has no effect on system behavior. Default: `''` for all states `Structure` Information about the estimable parameters of the `idss` model. `Structure.A`, `Structure.B`, `Structure.C`, `Structure.D`, and `Structure.K` contain information about the A, B, C, D, and K matrices, respectively. Each contains the following fields:`Value` — Parameter values. For example, `sys.Structure.A.Value` contains the initial or estimated values of the A matrix.`NaN` represents unknown parameter values.Each property `sys.A`, `sys.B`, `sys.C`, and `sys.D` is an alias to the corresponding `Value` entry in the `Structure` property of `sys`. For example, `sys.A` is an alias to the value of the property `sys.Structure.A.Value``Minimum` — Minimum value that the parameter can assume during estimation. For example, ```sys.Structure.K.Minimum = 0``` constrains all entries in the K matrix to be greater than or equal to zero. `Maximum` — Maximum value that the parameter can assume during estimation.`Free` — Boolean specifying whether the parameter is a free estimation variable. If you want to fix the value of a parameter during estimation, set the corresponding ```Free = false```. For example, if A is a 3-by-3 matrix, `sys.Structure.A.Free = eyes(3)` fixes all of the off-diagonal entries in A, to the values specified in `sys.Structure.A.Value`. In this case, only the diagonal entries in A are estimable.`Scale` — Scale of the parameter’s value. `Scale` is not used in estimation.`Info` — Structure array for storing parameter units and labels. The structure has `Label` and `Unit` fields.Specify parameter units and labels as character vectors. For example, `'Time'`. `NoiseVariance` The variance (covariance matrix) of the model innovations e. An identified model includes a white, Gaussian noise component e(t). `NoiseVariance` is the variance of this noise component. Typically, the model estimation function (such as `ssest`) determines this variance. For SISO models, `NoiseVariance` is a scalar. For MIMO models, `NoiseVariance` is a Ny-by-Ny matrix, where Ny is the number of outputs in the system. `Report` Summary report that contains information about the estimation options and results when the state-space model is obtained using estimation commands, such as `ssest`, `ssregest`, and `n4sid`. Use `Report` to query a model for how it was estimated, including its: Estimation methodEstimation optionsSearch termination conditionsEstimation data fit and other quality metrics The contents of `Report` are irrelevant if the model was created by construction. ```A = [-0.1 0.4; -0.4 -0.1]; B = [1; 0]; C = [1 0]; D = 0; m = idss(A,B,C,D); m.Report.OptionsUsed``` ```ans = []``` If you obtain the state-space model using estimation commands, the fields of `Report` contain information on the estimation data, options, and results. ```load iddata2 z2; m = ssest(z2,3); m.Report.OptionsUsed``` ```InitialState: 'auto' N4Weight: 'auto' N4Horizon: 'auto' Focus: 'prediction' EstimateCovariance: 1 Display: 'off' InputOffset: [] OutputOffset: [] OutputWeight: [] SearchMethod: 'auto' SearchOptions: [1x1 idoptions.search.identsolver] Regularization: [1x1 struct] Advanced: [1x1 struct]``` `Report` is a read-only property. For more information on this property and how to use it, see the Output Arguments section of the corresponding estimation command reference page and Estimation Report. `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 `OutputDelay` Output delays. For identified systems, like `idss`, `OutputDelay` is fixed to zero. `Ts` Sample time. For continuous-time models, `Ts = 0`. For discrete-time models, `Ts` is a positive scalar representing the sampling period expressed in the unit specified by the `TimeUnit` property of the model. To denote a discrete-time model with unspecified sample time, set ```Ts = -1```. Changing this property does not discretize or resample the model. Use `c2d` and `d2c` to convert between continuous- and discrete-time representations. Use `d2d` to change the sample time of a discrete-time system. Default: –1 (discrete-time model with unspecified sample time) `TimeUnit` Units for the time variable, the sample time `Ts`, and any time delays in the model, specified as one of the following values:`'nanoseconds'``'microseconds'``'milliseconds'``'seconds'` `'minutes'``'hours'``'days'``'weeks'``'months'``'years'` Changing this property has no effect on other properties, and therefore changes the overall system behavior. Use `chgTimeUnit` to convert between time units without modifying system behavior. Default: `'seconds'` `InputName` Input channel names, specified as one of the following: Character vector — For single-input models, for example, `'controls'`.Cell array of character vectors — For multi-input models. Alternatively, use automatic vector expansion to assign input names for multi-input models. For example, if `sys` is a two-input model, enter: `sys.InputName = 'controls';` The input names automatically expand to `{'controls(1)';'controls(2)'}`. When you estimate a model using an `iddata` object, `data`, the software automatically sets `InputName` to `data.InputName`. You can use the shorthand notation `u` to refer to the `InputName` property. For example, `sys.u` is equivalent to `sys.InputName`. Input channel names have several uses, including: Identifying channels on model display and plotsExtracting subsystems of MIMO systemsSpecifying connection points when interconnecting models Default: `''` for all input channels `InputUnit` Input channel units, specified as one of the following: Character vector — For single-input models, for example, `'seconds'`.Cell array of character vectors — For multi-input models. Use `InputUnit` to keep track of input signal units. `InputUnit` has no effect on system behavior. Default: `''` for all input channels `InputGroup` Input channel groups. The `InputGroup` property lets you assign the input channels of MIMO systems into groups and refer to each group by name. Specify input groups as a structure. In this structure, field names are the group names, and field values are the input channels belonging to each group. For example: ```sys.InputGroup.controls = [1 2]; sys.InputGroup.noise = [3 5];``` creates input groups named `controls` and `noise` that include input channels 1, 2 and 3, 5, respectively. You can then extract the subsystem from the `controls` inputs to all outputs using: `sys(:,'controls')` Default: Struct with no fields `OutputName` Output channel names, specified as one of the following: Character vector — For single-output models. For example, `'measurements'`.Cell array of character vectors — For multi-output models. Alternatively, use automatic vector expansion to assign output names for multi-output models. For example, if `sys` is a two-output model, enter: `sys.OutputName = 'measurements';` The output names automatically expand to `{'measurements(1)';'measurements(2)'}`. When you estimate a model using an `iddata` object, `data`, the software automatically sets `OutputName` to `data.OutputName`. You can use the shorthand notation `y` to refer to the `OutputName` property. For example, `sys.y` is equivalent to `sys.OutputName`. Output channel names have several uses, including: Identifying channels on model display and plotsExtracting subsystems of MIMO systemsSpecifying connection points when interconnecting models Default: `''` for all output channels `OutputUnit` Output channel units, specified as one of the following: Character vector — For single-output models. For example, `'seconds'`.Cell array of character vectors — For multi-output models. Use `OutputUnit` to keep track of output signal units. `OutputUnit` has no effect on system behavior. Default: `''` for all output channels `OutputGroup` Output channel groups. The `OutputGroup` property lets you assign the output channels of MIMO systems into groups and refer to each group by name. Specify output groups as a structure. In this structure, field names are the group names, and field values are the output channels belonging to each group. For example: ```sys.OutputGroup.temperature = ; sys.InputGroup.measurement = [3 5];``` creates output groups named `temperature` and `measurement` that include output channels 1, and 3, 5, respectively. You can then extract the subsystem from all inputs to the `measurement` outputs using: `sys('measurement',:)` Default: Struct with no fields `Name` System name, specified as a character vector. For example, `'system_1'`. Default: `''` `Notes` Any text that you want to associate with the system, stored as a string or a cell array of character vectors. The property stores whichever data type you provide. For instance, if `sys1` and `sys2` are dynamic system models, you can set their `Notes` properties as follows: ```sys1.Notes = "sys1 has a string."; sys2.Notes = 'sys2 has a character vector.'; sys1.Notes sys2.Notes``` ```ans = "sys1 has a string." ans = 'sys2 has a character vector.' ``` Default: `[0×1 string]` `UserData` Any type of data you want to associate with system, specified as any MATLAB® data type. Default: `[]` `SamplingGrid` Sampling grid for model arrays, specified as a data structure. For arrays of identified linear (IDLTI) models that are derived by sampling one or more independent variables, this property tracks the variable values associated with each model. This information appears when you display or plot the model array. Use this information to trace results back to the independent variables. Set the field names of the data structure to the names of the sampling variables. Set the field values to the sampled variable values associated with each model in the array. All sampling variables should be numeric and scalar valued, and all arrays of sampled values should match the dimensions of the model array. For example, if you collect data at various operating points of a system, you can identify a model for each operating point separately and then stack the results together into a single system array. You can tag the individual models in the array with information regarding the operating point: ```nominal_engine_rpm = [1000 5000 10000]; sys.SamplingGrid = struct('rpm', nominal_engine_rpm)``` where `sys` is an array containing three identified models obtained at rpms 1000, 5000 and 10000, respectively. For model arrays generated by linearizing a Simulink® model at multiple parameter values or operating points, the software populates `SamplingGrid` automatically with the variable values that correspond to each entry in the array. For example, the Simulink Control Design™ commands `linearize` and `slLinearizer` populate `SamplingGrid` in this way. Default: `[]`

## See Also

### Topics

#### Introduced before R2006a

##### Support Get trial now