System Identification Toolbox    

State-Space Models with Coupled Parameters: the idgrey Model

In some situations you may want the unknown parameters in the matrices in (3-51) or (3-52) to be linked to each other. Then the NaN feature is not sufficient to describe these links. Instead you need to do some "greybox" modeling and write an M-file that describes the structure. The format is

where mymfile is the user-defined name for the M-file, par contains the parameters as a column vector, T is the sampling interval, and aux contains auxiliary variables. The latter variables are used to house options, so that some different cases can be tried out without having to edit the M-file. The matrices A, B, C, D, K, and x0 refer either to the continuous time description (3-52) or to the discrete-time description (3-51). When a continuous time description is fitted to sampled data, the estimation routines perform the necessary sampling of the model. To obtain the same structure as in the Example 3.2, you can do the following.

Once the M-file has been written, the idgrey model m is defined by the command

where par contains the nominal (initial) values of the corresponding entries in the structure. 'c' signals that the underlying parametrization is continuous time. aux contains the values of the auxiliary parameters. Note that T and aux must be given as input arguments, even if they are not used by the code.

From here on, estimate models and evaluate results as for any other model structure. Some further examples of user-defined model structures are given below.

Some Examples of idgrey Model Structures

With user-defined structures, you have complete freedom in the choice of models of linear systems. This section gives two examples of such structures.

Example 3.3: Heat Diffusion.   Consider a system driven by the heat-diffusion equation (see also Example 4.3 in Ljung (1999)).

This is a metal rod with a heat-diffusion coefficient , which is insulated at the near end and heated by the power u (W) at the far end. The output of the system is the temperature at the near end. This system is described by a partial differential equation in time and space. Replacing the space-second derivative by a corresponding difference approximation gives a time-continuous state-space model (3-52), where the dimension of x depends on the grid-size in space used in the approximation. It is also desirable to be able to work with different grid sizes without having to edit the model file. This is described by the following M-file.

You can then define the model by

for a 10th order approximation of a heat rod one meter in length, with an initial temperature of 22 degrees. The initial estimate of the heat conductivity is 0.27, and of the heat transfer coefficient is 1.

The model parameters are estimated by

If you would like to try a finer grid, that is, take Ngrid larger, you can do this easily with

Example 3.4: Parametrized Disturbance Models.   Consider a discrete-time model

where w and e are independent white noises with covariance matrices R1 and R2, respectively. Suppose that you know the variance of the measurement noise R2, and that only the first component of is nonzero. This can be handled by the following M-file.


  Structured State-Space Models with Free Parameters: the idss Model State-Space Structures: Initial Values and Numerical Derivatives