Products & Services Solutions Academia Support User Community Company

Learn more about System Identification Toolbox   

idgrey - Linear ODE (grey-box model) with known and unknown parameters

Syntax

m = idgrey(MfileName,ParameterVector,CDmfile)
m = idgrey(MfileName,ParameterVector,CDmfile,FileArgument,Ts,...
'Property1',Value1,...,'PropertyN',ValueN)

Description

The function idgrey is used to create arbitrarily parameterized state-space models as idgrey objects.

MfileName is the name of an M-file that defines how the state-space matrices depend on the parameters to be estimated. The format of this M-file is given by

[A,B,C,D,K,X0] = mymfile(pars,Tsm,Auxarg)

and is further discussed below.

ParameterVector is a column vector of the nominal/initial parameters. Its length must be equal to the number of free parameters in the model (that is, the argument pars in the example below).

The argument CDmfile describes how the user-written M-file handles continuous and discrete-time models. It takes the following values:

The argument FileArgument corresponds to the auxiliary argument Auxarg in the user-written M-file. It can be used to handle several variants of the model structure, without having to edit the M-file. If it is not used, enter FileArgument = []. (Default.)

Ts denotes the sampling interval of the model. Its default value is Ts = 0, that is, a continuous-time model.

The idgrey object is a child of idmodel. Therefore any idmodel properties can be set as property name/property value pairs in the idgrey command. They can also be set by the command set, or by subassignment, as in

m.InputName = {'speed','voltage'}
m.FileArgument = 0.23

There are also two properties, DisturbanceModel and InitialState, that can be used to affect the parameterizations of K and X0, thus overriding the outputs from the M-file.

idgrey Properties

In addition, any idgrey object also has all the properties of idmodel. See Algorithm Properties and the reference page for idmodel.

Note that you can set or retrieve all properties using either the set and get commands or subscripts. Autofill applies to all properties and values, and they are case insensitive.

m.fi = 10;
set(m,'search','gn')
p = roots(m.a)

For a complete list of property values, use get(m). To see possible value assignments, use set(m).

M-File Details

The model structure corresponds to the general linear state-space structure

Here is the time derivative for a continuous-time model and for a discrete-time model.

The matrices in this time-discrete model can be parameterized in an arbitrary way by the vector . Write the format for the M-file as follows:

[A,B,C,D,K,x0] = mymfile(pars,T,Auxarg) 

Here the vector pars contains the parameters , and the output arguments A, B, C, D, K, and x0 are the matrices in the model description that correspond to this value of the parameters and this value of the sampling interval T.

T is the sampling interval, and Auxarg is any variable of auxiliary quantities with which you want to work. (In that way you can change certain constants and other aspects in the model structure without having to edit the M-file.) Note that the two arguments T and Auxarg must be included in the function head of the M-file, even if they are not used within the M-file.

A comment about CDmfile: If a continuous-time model is sought, it is easiest to let the M-file deliver just the continuous-time model, that is, have CDmfile = 'c' and rely upon the toolbox's routines for the proper sampling. Similarly, if the underlying parameterization is indeed discrete time, it is natural to deliver the discrete-time model matrices and let CDmfile = 'd'. If the underlying parameterization is continuous, but you prefer for some reason to do your own sampling inside the M-file in accordance with the value of T, then let your M-file deliver the continuous-time model when called with T = 0, that is, the alternative CMmfile = 'cd'. This avoids sampling and then transforming back (using d2c) to find the continuous-time model.

idgrey Definition of States

The states of an idgrey model are defined explicitly by the user in the M-file or MEX-file (as specified in MfileName property) storing the model structure. The concept of states is useful for functions such as sim, predict, compare and findstates.

Examples

In this example, you use the M-file mynoise given in Example – Estimating a Discrete-Time Grey-Box Model with Parameterized Disturbance to obtain a physical parameterization of the Kalman gain. You estimate the unknown parameters of this model using the estimation data z.

mn = idgrey('mynoise',[0.1,-2,1,3,0.2]','d',1)
m = pem(z,mn)
  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS