Documentation Center 
Linear ODE (greybox model) with identifiable parameters
sys = idgrey(odefun,parameters,fcn_type)
sys = idgrey(odefun,parameters,fcn_type,optional_args)
sys = idgrey(odefun,parameters,fcn_type,optional_args,Ts)
sys = idgrey(odefun,parameters,fcn_type,optional_args,Ts,Name,Value)
sys = idgrey(odefun,parameters,fcn_type) creates a linear greybox model with identifiable parameters, sys. odefun specifies the userdefined function that relates the model parameters, parameters, to its statespace representation.
sys = idgrey(odefun,parameters,fcn_type,optional_args) creates a linear greybox model with identifiable parameters using the optional arguments required by odefun.
sys = idgrey(odefun,parameters,fcn_type,optional_args,Ts) creates a linear greybox model with identifiable parameters with the specified sample time, Ts.
sys = idgrey(odefun,parameters,fcn_type,optional_args,Ts,Name,Value) creates a linear greybox model with identifiable parameters with additional options specified by one or more Name,Value pair arguments.
An idgrey model represents a system as a continuoustime or discretetime statespace model with identifiable (estimable) coefficients.
A statespace model of a system with input vector, u, output vector, y, and disturbance, e, takes the following form in continuous time:
In discrete time, the statespace model takes the form:
For idgrey models, the statespace matrices A, B, C, and D are expressed as a function of userdefined parameters using a MATLAB^{®} function. You access estimated parameters using sys.Structures.Parameters, where sys is an idgrey model.
Use an idgrey model when you know the system of equations governing the system dynamics explicitly. You should be able to express these dynamics in the form of ordinary differential or difference equations. You specify complex relationships and constraints among the parameters that cannot be done through structured statespace models (idss).
You can create an idgrey model using the idgrey command. To do so, write a MATLAB function that returns the A, B, C, and D matrices for given values of the estimable parameters and sampling time. The MATLAB function can also return the K matrix and accept optional input arguments. The matrices returned may represent a continuoustime or discretetime model, as indicated by the sampling time.
Use the estimating functions pem or greyest to obtain estimated values for the unknown parameters of an idgrey model.
You can convert an idgrey model into other dynamic systems, such as idpoly, idss, tf, ss etc. You cannot convert a dynamic system into an idgrey model.
odefun 
MATLAB function that relates the model parameters to its statespace representation. odefun specifies, as a string, the name of a MATLAB function (.m, .p, a function handle or .mex* file). This function establishes the relationship between the model parameters, parameters, and its statespace representation. The function may optionally relate the model parameters to the disturbance matrix and initial states. If the function is not on the MATLAB path, then specify the full file name, including the path. The syntax for odefun must be as follows: [A,B,C,D] = odefun(par1,par2,...,parN,Ts,optional_arg1,optional_arg2,...) The function outputs describe the model in the following linear statespace innovations form:
In discrete time xn(t)=x(t+Ts) and in continuous time, . par1,par2,...,parN are model parameters. Each entry may be a scalar, vector or matrix. Ts is the sample time. optional_arg1,optional_arg2,... are the optional inputs that odefun may require. The values of the optional input arguments are unchanged through the estimation process. However, the values of par1,par2,...,parN are updated during estimation to fit the data. Use optional input arguments to vary the constants and coefficients used by your model without editing odefun. The disturbance matrix, K, and the initial state values, x0, are not parametrized. Instead, these values are determined separately, using the DisturbanceModel and InitialState estimation options, respectively. For more information regarding the estimation options, see greyestOptions. A good choice for achieving the best simulation results is to set the DisturbanceModel option to 'none', which fixes K to zero. (Optional) Parameterizing Disturbance: odefun can also return the disturbance component, K, using the syntax: [A,B,C,D,K] = odefun(par1,par2,...,parN,Ts,optional_arg1,optional_arg2,...) If odefun returns a value for K that contains NaN values, then the estimating function assumes that K is not parameterized. In this case, the value of the DisturbanceModel estimation option determines how K is handled. (Optional) Parameterizing Initial State Values: To make the model initial states, X0, dependent on the model parameters, use the following syntax for odefun: [A,B,C,D,K,X0] = odefun(par1,par2,...,parN,Ts,optional_arg1,optional_arg2,...) If odefun returns a value for X0 that contains NaN values, then the estimating function assumes that X0 is not parameterized. In this case, X0 may be fixed to zero or estimated separately, using the InitialStates estimation option. 
parameters 
Initial values of the parameters required by odefun. Specify parameters as a cell array containing the parameter initial values. If your model requires only one parameter, which may itself be a vector or a matrix, you may specify parameters as a matrix. You may also specify parameter names using an Nby2 cell array, where N is the number of parameters. The first column specifies the names, and the second column specifies the values of the parameters. For example: parameters = {'mass',par1;'stiffness',par2;'damping',par3} 
fcn_type 
Indicates whether the model is parameterized in continuoustime, discretetime, or both. fcn_type requires one of the following strings:

optional_args 
Optional input arguments required by odefun. Specify optional_args as a cell array. If odefun does not require optional input arguments, specify optional_args as {}. 
Ts 
Model sampling time. If Ts is unspecified, it is assumed to be:

Name,Value 
Specify optional commaseparated pairs of Name,Value arguments, where Name is the argument name and Value is the corresponding value. Name must appear inside single 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 idgrey models during model creation. For example, idgrey(odefun,parameters,fcn_type,'InputName','Voltage') creates an idgrey model with the InputName property set to Voltage. 
idgrey object properties include:
a,b,c,d 
Values of statespace matrices.
The values a,b,c,d are returned by the ODE function associated with the idgrey model. Thus, you can only read these matrices; you cannot set their values. 
k 
Value of state disturbance matrix, K k is NxbyNy matrix, where Nx is the number of states and Ny is the number of outputs.
To create an estimation option set for idgrey models, use greyestOptions. 
StateName 
State names. For firstorder models, set StateName to a string. For models with two or more states, set StateName to a cell array of strings . Use an empty string '' for unnamed states. Default: Empty string '' for all states 
StateUnit 
State units. Use StateUnit to keep track of the units each state is expressed in. For firstorder models, set StateUnit to a string. For models with two or more states, set StateUnit to a cell array of strings. StateUnit has no effect on system behavior. Default: Empty string '' for all states 
Structure 
Information about the estimable parameters of the idgrey model. Structure stores information regarding the MATLAB function that parameterizes the idgrey model.

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 greyest or pem) determines this variance. For SISO models, NoiseVariance is a scalar. For MIMO models, NoiseVariance is a NybyNy matrix, where Ny is the number of outputs in the system. 
Report 
Information about the estimation process. Report contains the following fields:

InputDelay 
Input delay for each input channel, specified as a scalar value or numeric vector. For continuoustime systems, specify input delays in the time unit stored in the TimeUnit property. For discretetime systems, specify input delays in integer multiples of the sampling period Ts. For example, InputDelay = 3 means a delay of three sampling periods. For a system with Nu inputs, set InputDelay to an Nuby1 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 idgrey, OutputDelay is fixed to zero. 
Ts 
Sampling time. For continuoustime models, Ts = 0. For discretetime 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 discretetime model with unspecified sampling time, set Ts = 1. Changing this property does not discretize or resample the model. For idgrey models, there is no unique default value for Ts. Ts depends on the value of fcn_type. 
TimeUnit 
String representing the unit of the time variable. For continuoustime models, this property represents any time delays in the model. For discretetime models, it represents the sampling time Ts. Use any of the following values:
Changing this property changes the overall system behavior. Use chgTimeUnit to convert between time units without modifying system behavior. Default: 'seconds' 
InputName 
Input channel names. Set InputName to a string for singleinput model. For a multiinput model, set InputName to a cell array of strings. Alternatively, use automatic vector expansion to assign input names for multiinput models. For example, if sys is a twoinput 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:
Default: Empty string '' for all input channels 
InputUnit 
Input channel units. Use InputUnit to keep track of input signal units. For a singleinput model, set InputUnit to a string. For a multiinput model, set InputUnit to a cell array of strings. InputUnit has no effect on system behavior. Default: Empty string '' 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. Set OutputName to a string for singleoutput model. For a multioutput model, set OutputName to a cell array of strings. Alternatively, use automatic vector expansion to assign output names for multioutput models. For example, if sys is a twooutput model, enter: sys.OutputName = 'measurements'; The output names to 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:
Default: Empty string '' for all input channels 
OutputUnit 
Output channel units. Use OutputUnit to keep track of output signal units. For a singleoutput model, set OutputUnit to a string. For a multioutput model, set OutputUnit to a cell array of strings. OutputUnit has no effect on system behavior. Default: Empty string '' for all input 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 = [1]; 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. Set Name to a string to label the system. Default: '' 
Notes 
Any text that you want to associate with the system. Set Notes to a string or a cell array of strings. Default: {} 
UserData 
Any type of data you wish to associate with system. Set UserData to 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. Default: [] 
getpvec  greyest  greyestOptions  idnlgrey  idss  pem  setpvec  ssest