*Structured parameterization* lets you exclude specific parameters from
estimation by setting these parameters to specific values. This approach is useful when you can
derive state-space matrices from physical principles and provide initial parameter values based
on physical insight. You can use this approach to discover what happens if you fix specific
parameter values or if you free certain parameters.

There are two stages to the structured estimation procedure:

Specify the state-space model structure, as described in Specify the State-Space Model Structure

Estimate the free model parameters, as described in Estimate State-Space Models at the Command Line

This approach differs from estimating models with free and canonical parameterizations, where it is not necessary to specify initial parameter values before the estimation. For free parameterization, there is no structure to specify because it is assumed to be unknown. For canonical parameterization, the structure is fixed to a specific form.

**Note**

To estimate structured state-space models in the System Identification app, define the corresponding model structures at the command line and import them into the System Identification app.

To specify the state-space model structure:

Use

`idss`

to create a state-space model. For example:`A = [0 1; 0 -1]; B = [0; 0.28]; C = eye(2); D = zeros(2,1); m = idss(A,B,C,D,K,'Ts',T)`

creates a discrete-time state-space structure, where

`A`

,`B`

,`C`

,`D`

, and`K`

specify the initial values for the free parameters.`T`

is the sample time.Use the

`Structure`

property of the model to specify which parameters to estimate and which to set to specific values.For example, if you want to fix

`A(1,2)=A(2,1)=0`

, use:m.Structure.A.Value(1,2) = 0; m.Structure.A.Value(2,1) = 0; m.Structure.A.Free(1,2) = false; m.Structure.A.Free(2,1) = false;

The estimation algorithm only estimates the parameters in

`A`

for which`m.Structure.A.Free`

is`true`

.Use physical insight, whenever possible, to initialize the parameters for the iterative search algorithm. Because it is possible that the numerical minimization gets stuck in a local minimum, try several different initialization values for the parameters. For random initialization, use

`init`

. When the model structure contains parameters with different orders of magnitude, try to scale the variables so that the parameters are all roughly the same magnitude.Alternatively, to quickly configure the parameterization and whether to estimate feedthrough and disturbance dynamics, use

`ssform`

.Use

`ssest`

to estimate the model, as described in Estimate State-Space Models at the Command Line.

The iterative search computes gradients of the prediction errors with respect to the
parameters using numerical differentiation. The step size is specified by the
`nuderst`

command. The default step size is equal to
10^{–4} times the absolute value of a parameter or equal to
10^{–7}, whichever is larger. To specify a different step size, edit
the `nuderst`

MATLAB^{®} file.

You estimate state-space models with structured
parameterization when you know some parameters of a linear system and need to estimate
the others. These models are therefore similar to grey-box models. However, in this toolbox, the
"grey box modeling" terminology is used only when referring to `idgrey`

and `idnlgrey`

models. In these models, you can specify
complete linear or nonlinear models with complicated relationships between the unknown
parameters.

If you have independent unknown matrix elements in a linear state-space model structure,
then it is easier and quicker to use state-space models with structured parameterizations. For
imposing dependencies, or to use more complex forms of parameterization, use the `idgrey`

model and the associated `greyest`

estimator. For more information, see Grey-Box Model Estimation.

If you want to incorporate prior knowledge regarding the state and output covariances into
the estimation process, use an `idgrey`

model to identify your system using a
general state-space model structure. For more information, see Identifying State-Space Models with Separate Process and Measurement Noise Descriptions.

This example shows how to estimate the unknown parameters of a discrete-time model.

In this example, you estimate $${\theta}_{1},{\theta}_{2},{\theta}_{3},{\theta}_{4},{\theta}_{5}$$ in the following discrete-time model:

$$\begin{array}{l}x(t+1)=\left[\begin{array}{cc}1& {\theta}_{1}\\ 0& 1\end{array}\right]x(t)+\left[\begin{array}{c}{\theta}_{2}\\ {\theta}_{3}\end{array}\right]u(t)+\left[\begin{array}{c}{\theta}_{4}\\ {\theta}_{5}\end{array}\right]e(t)\\ y(t)=\left[\begin{array}{cc}1& 0\end{array}\right]x(t)+e(t)\\ x(0)=\left[\begin{array}{c}0\\ 0\end{array}\right]\end{array}$$

Suppose that the nominal values of the unknown parameters ( $${\theta}_{1},{\theta}_{2},{\theta}_{3},{\theta}_{4},{\theta}_{5}$$) are `-1`

, `2`

, `3`

, `4`

,and `5`

, respectively.

The discrete-time state-space model structure is defined by the following equation:

$$\begin{array}{l}x(kT+T)=Ax(kT)+Bu(kT)+Ke(kT)\\ y(kT)=Cx(kT)+Du(kT)+e(kT)\\ x(0)=x0\end{array}$$

Construct the parameter matrices and initialize the parameter values using the nominal parameter values.

A = [1,-1;0,1]; B = [2;3]; C = [1,0]; D = 0; K = [4;5];

Construct the state-space model object.

m = idss(A,B,C,D,K);

Specify the parameter values in the structure matrices that you do not want to estimate.

S = m.Structure; S.A.Free(1,1) = false; S.A.Free(2,:) = false; S.C.Free = false; m.Structure = S;

`D`

is initialized, by default, as a fixed value, and `K`

and `B`

are initialized as free values. Suppose you want to fix the initial states to known zero values. To enforce this, configure the `InitialState`

estimation option.

```
opt = ssestOptions;
opt.InitialState = 'zero';
```

Load estimation data.

load iddata1 z1;

Estimate the model structure.

m = ssest(z1,m,opt);

where `z1`

is name of the `iddata`

object. The data can be time-domain or frequency-domain data. The iterative search starts with the nominal values in the `A`

, `B`

, `C,`

`D`

, and `K`

matrices.

This example shows how to estimate the unknown parameters of a continuous-time model.

In this example, you estimate $${\theta}_{1},{\theta}_{2},{\theta}_{3}$$ in the following continuous-time model:

$$\begin{array}{l}\underset{}{\overset{\dot{}}{x}}(t)=\left[\begin{array}{cc}0& 1\\ 0& {\theta}_{1}\end{array}\right]x(t)+\left[\begin{array}{c}0\\ {\theta}_{2}\end{array}\right]u(t)\\ y(t)=\left[\begin{array}{cc}1& 0\\ 0& 1\end{array}\right]x(t)+e(t)\\ x(0)=\left[\begin{array}{c}{\theta}_{3}\\ 0\end{array}\right]\end{array}$$

This equation represents an electrical motor, where $${y}_{1}(t)={x}_{1}(t)$$ is the angular position of the motor shaft, and $${y}_{2}(t)={x}_{2}(t)$$ is the angular velocity. The parameter $$-{\theta}_{1}$$ is the inverse time constant of the motor, and $${\theta}_{2}$$ $$/$$ $${\theta}_{1}$$ is the static gain from the input to the angular velocity.

The motor is at rest at `t=0`

, but its angular position $${\theta}_{3}$$ is unknown. Suppose that the approximate nominal values of the unknown parameters are $${\theta}_{1}=-1$$ and $${\theta}_{2}=0.25$$.

The variance of the errors in the position measurement is `0.01`

, and the variance in the angular velocity measurements is `0.1`

. For more information about this example, see the section on state-space models in *System Identification: Theory for the User*, Second Edition, by Lennart Ljung, Prentice Hall PTR, 1999.

The continuous-time state-space model structure is defined by the following equation:

$$\begin{array}{l}\underset{}{\overset{\dot{}}{x}}(t)=Fx(t)+Gu(t)+\underset{}{\overset{\sim}{K}}w(t)\\ y(t)=Hx(t)+Du(t)+w(t)\\ x(0)=x0\end{array}$$

Construct the parameter matrices and initialize the parameter values using the nominal parameter values.

A = [0 1;0 -1]; B = [0;0.25]; C = eye(2); D = [0;0]; K = zeros(2,2); x0 = [0;0];

The matrices correspond to continuous-time representation. However, to be consistent with the `idss`

object property name, this example uses `A`

, `B`

, and `C`

instead of `F`

, `G`

, and `H`

.

Construct the continuous-time state-space model object.

`m = idss(A,B,C,D,K,'Ts',0);`

Specify the parameter values in the structure matrices that you do not want to estimate.

S = m.Structure; S.A.Free(1,:) = false; S.A.Free(2,1) = false; S.B.Free(1) = false; S.C.Free = false; S.D.Free = false; S.K.Free = false; m.Structure = S; m.NoiseVariance = [0.01 0; 0 0.1];

The initial state is partially unknown. Use the `InitialState`

option of the `ssestOptions`

option set to configure the estimation behavior of `X0`

.

opt = ssestOptions; opt.InitialState = idpar(x0); opt.InitialState.Free(2) = false;

Estimate the model structure.

load(fullfile(matlabroot,'toolbox','ident','iddemos','data','dcmotordata')); z = iddata(y,u,0.1); m = ssest(z,m,opt);

The iterative search for a minimum is initialized by the parameters in the nominal model `m`

. The continuous-time model is sampled using the same sample time as the data during estimation.

Simulate this system using the sample time `T=0.1`

for input `u`

and the noise realization `e`

.

e = randn(300,2); u1 = idinput(300); simdat = iddata([],u1,'Ts',0.1); simopt = simOptions('AddNoise',true,'NoiseData',e); y1 = sim(m,simdat,simopt);

The continuous system is sampled using `Ts=0.1`

for simulation purposes. The noise sequence is scaled according to the matrix `m.NoiseVariance`

.

If you discover that the motor was not initially at rest, you can estimate $${x}_{2}(0)$$ by setting the second element of the `InitialState`

parameter to be free.

opt.InitialState.Free(2) = true; m_new = ssest(z,m,opt);