## Identifying State-Space Models with Separate Process and Measurement Noise Descriptions

### General Model Structure

An identified linear model is used to simulate and predict system outputs for given input and noise signals. The input signals are measured while the noise signals are only known via their statistical mean and variance. The general form of the state-space model, often associated with Kalman filtering, is an example of such a model, and is defined as:

 $\begin{array}{c}x\left(t+1\right)=A\left(\theta \right)x\left(t\right)+B\left(\theta \right)u\left(t\right)+w\left(t\right)\\ \text{ }\text{\hspace{0.17em}}y\left(t\right)=C\left(\theta \right)x\left(t\right)+D\left(\theta \right)u\left(t\right)+v\left(t\right),\end{array}$ (1)

where, at time t:

• x(t) is the vector of model states.

• u(t) is the measured input data.

• y(t) is the measured output data.

• w(t) is the process noise.

• v(t) is the measurement noise.

The noise disturbances are independent random variables with zero mean and covariances:

`$\begin{array}{c}E\left[w\left(t\right){w}^{⊺}\left(t\right)\right]={R}_{1}\left(\theta \right)\\ \text{ }\text{ }\text{\hspace{0.17em}}\text{ }E\left[v\left(t\right){v}^{⊺}\left(t\right)\right]={R}_{2}\left(\theta \right)\\ E\left[w\left(t\right){v}^{⊺}\left(t\right)\right]={R}_{12}\left(\theta \right)\end{array}$`

The vector θ parameterizes the model, including the coefficients of the system matrices and the noise covariances. However, all elements of the model are not necessarily free. If you have physical insight into the states of the system and sources of noise, the model can have a specific structure with few parameters in the vector θ.

### Innovations Form and One-Step Ahead Predictor

For a given value of θ, you want to predict the best estimates of x(t) and y(t) in the presence of any disturbances. The required predictor model equations are derived from the Kalman filtering technique:

 $\begin{array}{c}\stackrel{^}{x}\left(t+1,\theta \right)=A\left(\theta \right)x\left(t\right)+B\left(\theta \right)u\left(t\right)+K\left(\theta \right)\left[y\left(t\right)-C\left(\theta \right)\stackrel{^}{x}\left(t,\theta \right)-D\left(\theta \right)u\left(t\right)\right]\\ \text{ }\text{\hspace{0.17em}}\stackrel{^}{y}\left(t,\theta \right)=C\left(\theta \right)\stackrel{^}{x}\left(t\right)+D\left(\theta \right)u\left(t\right),\end{array}$ (2)

where $\stackrel{^}{x}\left(t,\theta \right)$ is the predicted value of the state vector x(t) at time instant t, and $\stackrel{^}{y}\left(t,\theta \right)$ is the predicted value of output y(t). The variables u(t) and y(t) in the above equation represent the measured input and output values at time t. The Kalman Gain matrix, K(θ), is derived from the system matrices and noise covariances as follows:

`$K\left(\theta \right)=\left[A\left(\theta \right)\Gamma \left(\theta \right){C}^{⊺}\left(\theta \right)+{R}_{12}\left(\theta \right)\right]{\left[C\left(\theta \right)\Gamma \left(\theta \right){C}^{⊺}\left(\theta \right)+{R}_{2}\left(\theta \right)\right]}^{-1},$`

where $\Gamma \left(\theta \right)$ is the covariance of the state estimate error:

`$\Gamma \left(\theta \right)=\overline{E}\left[\left[x\left(t\right)-\stackrel{^}{x}\left(t,\theta \right)\right]{\left[x\left(t\right)-\stackrel{^}{x}\left(t,\theta \right)\right]}^{⊺}\right].$`

$\Gamma \left(\theta \right)$ is the solution of an algebraic Riccati equation. For more information, see `dare` (Control System Toolbox) and [1]

Denoting the output prediction error as $e\left(t\right)=y\left(t\right)-\stackrel{^}{y}\left(t,\theta \right)$, you can write the general state-space model in a simpler form:

 $\begin{array}{c}x\left(t+1,\theta \right)=A\left(\theta \right)x\left(t\right)+B\left(\theta \right)u\left(t\right)+K\left(\theta \right)e\left(t\right)\\ \text{ }\text{\hspace{0.17em}}y\left(t\right)=C\left(\theta \right)x\left(t\right)+D\left(\theta \right)u\left(t\right)+e\left(t\right).\end{array}$ (3)

This simpler representation is the innovations form of the state-space model, and has only one unique disturbance source, e(t). This form corresponds to choosing R2=I, R12=K, and R1=KKT for the general model structure. System Identification Toolbox™ software uses the innovations form as its primary representation of state-space models.

Both the general and innovations form of the model lead to the same predictor model as shown in Equation 2. Use the `predict` command to compute the predicted model response and to generate this predictor system.

### Model Identification

The identification task is to use input and output measurement data to determine the parameterization vector, θ. The approach to take depends on the amount of prior information available regarding the system and the noise disturbances.

#### Black Box Identification

When only input-output data measurements are available, and you have no knowledge of the noise structure, you can only estimate the model in the innovations form. To do so, we use the one-step ahead prediction error minimization approach (PEM) to compute the best output predictor. For this approach, the matrix K is parameterized independently of the other system matrices, and no prior information about the system states or output covariances is considered for estimation. The estimated model can be cast back into the general model structure in many nonunique ways, one of which is to assume R2=I, R12=K, and R1=KKT. The innovations form is a system representation of the predictor in which e(t) does not necessarily represent the actual measurement noise.

Estimate state-space models in the innovations form using the `n4sid`, `ssest`, and `ssregest` commands. The system matrices A, B, C, D, and K are parameterized independently and the identification minimizes the weighted norm of the prediction error, e(t). For more information, see Estimating State-Space Models Using ssest, ssregest and n4sid and the estimation examples in `ssest`.

Note

In this case, the estimation algorithm chooses the model states arbitrarily. As a result, it is difficult to imagine physically meaningful descriptions of the states and the sources for the disturbances affecting them.

#### Structured Identification

In some situations, in addition to the input-output data, you know something about the state and measurement disturbances. To make the notion of state disturbances meaningful, it is necessary that the states be well-defined, such as the positions and velocities in a mechanical lumped-mass system. Well-defined states and known noise sources result in a structured state-space model, which you can then parameterize using the general model structure of Equation 1.

To identify such models, use a grey-box modeling approach, which lets you use any prior knowledge regarding the system parameters and noise covariances. For example, you may know that only the first element of R1 is nonzero, or that all the off-diagonal terms of R2 are zero. When using grey-box modeling, provide initial guess values for the parameterization vector, θ. If the model states are physically meaningful, it should be possible to determine initial estimates for the parameters in θ.

To estimate a grey-box model with parameterized disturbances:

• Create a MATLAB® function, called the ODE file, that:

• Computes the parameterized state-space matrices, A, B, C, and D, using the parameter vector θ, which is supplied as an input argument.

• Computes the noise covariance matrices R1, R2, and R12. Each of these matrices can be completely or partially unknown. Any unknown matrix elements are defined in terms of parameters in θ.

• Uses the system matrices A and C, and the noise covariances with the `kalman` (Control System Toolbox) command to find the Kalman gain matrix, K.

`[~,K] = kalman(ss(A,eye(nx),C,zeros(ny,nx),Ts),R1,R2,R12);`

Here, `nx` is the number of model states, `ny` is the number of model outputs, and `Ts` is the sample time. The `kalman` command requires Control System Toolbox™ software.

• Returns A, B, C, D, and K as output arguments.

• Create an `idgrey` model that uses the ODE function and an initial guess value for the parameter vector, θ.

• Configure any estimation options using the `greyestOptions` command.

• Estimate θ using `greyest` command.

For an example of using parameterized disturbances with grey-box modeling, see Estimate Discrete-Time Grey-Box Model with Parameterized Disturbance.

### Summary

Use the innovations form if all you have is measured input-output data. It is worthwhile to use the general form only if you can define a system parameterization with meaningful states, and you have nontrivial knowledge about the noise covariances. In this case, use grey-box estimation to identify the state-space model.

Both the general form and the innovations form lead to the same predictor. So, if your end goal is to deploy the model for predicting future outputs or to perform simulations, it is more convenient to use the innovations form of the model.

## References

[1] Ljung, L. “State-Space Models.” Section 4.3 in System Identification: Theory for the User. 2nd ed. Upper Saddle River, NJ: Prentice Hall, 1999, pp. 93–102.