| Control System Toolbox™ | ![]() |
| On this page… |
|---|
Accessing Property Values Using get |
The previous section shows how to create LTI objects that encapsulate the model data and sample time. You also have the option to attribute additional information, such as the input names or notes on the model history, to LTI objects. This section gives a complete overview of the LTI properties, i.e., the various pieces of information that can be attached to the TF, ZPK, SS, and FRD objects. Type helpltiprops for online help on available LTI properties.
From a data structure standpoint, the LTI properties are the various fields in the TF, ZPK, SS, and FRD objects. These fields have names (the property names) and are assigned values (the property values). We distinguish between generic properties, common to all four types of LTI objects, and model-specific properties that pertain only to one particular type of model.
The generic properties are those shared by all four types of LTI models (TF, ZPK, SS, and FRD objects). They are listed in the table below.
LTI Properties Common to All LTI Objects
Property Name | Description | Data Type |
|---|---|---|
| InputDelay | Vector | |
| InputGroup | Input channel groups | Structure |
| InputName | Cell vector of strings | |
| Notes | Notes on the model history | Text |
| OutputDelay | Vector | |
| OutputGroup | Output channel groups | Structure |
| OutputName | Cell vector of strings | |
| Ts | Scalar | |
| Userdata | Additional data | Arbitrary |
The sample time property Ts keeps track of the sample time (in seconds) of discrete-time systems. By convention, Ts is 0 (zero) for continuous-time systems, and Ts is -1 for discrete-time systems with unspecified sample time. Ts is always a scalar, even for MIMO systems.
The InputDelay, OutputDelay, ioDelay and InternalDelay properties allow you to specify time delays in the input or output channels, or for each input/output pair. Their default value is zero (no delay). See Time Delays for details on modeling delays.
The InputName and OutputName properties enable you to give names to the individual input and output channels. The value of each of these properties is a cell vector of strings with as many cells as inputs or outputs. For example, the OutputName property is set to
{ 'temperature' ; 'pressure' }
for a system with two outputs labeled temperature and pressure. The default value is a cell of empty strings.
Using the InputGroup and OutputGroup properties of LTI objects, you can create different groups of input or output channels, and assign names to the groups. For example, you may want to designate the first four inputs of a five-input model as controls, and the last input as noise. See Input Groups and Output Groups for more information.
Finally, Notes and Userdata are available to store additional information on the model. The Notes property is dedicated to any text you want to supply with your model, while the Userdata property can accommodate arbitrary user-supplied data. They are both empty by default.
For more detailed information on how to use LTI properties, see Additional Insight into LTI Properties.
The remaining LTI properties are specific to one of the four model types (TF, ZPK, SS, or FRD). For single LTI models, these are summarized in the following four tables. The property values differ for LTI arrays. See set for more information on these values.
Property Name | Description | Data Type |
|---|---|---|
| den | Real cell array of row vectors | |
| num | Real cell array of row vectors | |
| ioDelay | Matrix | |
| Variable | String 's', 'p', 'z', 'q', or 'z^-1' |
Property Name | Description | Data Type |
|---|---|---|
| z | Cell array of column vectors | |
| p | Cell array of column vectors | |
| k | Two-dimensional real matrix | |
| Variable | Transfer function variable | String 's', 'p', 'z', 'q', or 'z^-1' |
| ioDelay | Matrix |
Property Name | Description | Data Type |
|---|---|---|
| a | 2-D real matrix | |
| b | Input-to-state matrix B | 2-D real matrix |
| c | State-to-output matrix C | 2-D real matrix |
| d | 2-D real matrix | |
| e | Descriptor E matrix | 2-D real matrix |
| InternalDelay | Vector | |
| StateName | Cell vector of strings | |
| Scaled | When false, numerical algorithms rescale the state vector to improve accuracy. When true, the model is marked as already scaled and no rescaling occurs. | 0 for false, 1 for true |
Property Name | Description | Data Type |
|---|---|---|
Frequency | Frequency data points | Real-valued vector |
ResponseData | Frequency response | Complex-valued multidimensional array |
Units | Units for frequency | String 'rad/s' or 'Hz' |
Most of these properties are dedicated to storing the model
data. Note that the
matrix is set to [] (the
empty matrix) for standard state-space models, a storage-efficient
shorthand for the true value
.
The Variable property is only an attribute
of TF and ZPK objects. This property defines the frequency variable
of transfer functions. The default values are 's' (Laplace
variable
) in continuous time and 'z' (Z-transform
variable
) in discrete time. Alternative
choices include 'p' (equivalent to
) and 'q' or 'z^-1' for
the reciprocal
of the
variable. The
influence of the variable choice is mostly limited to the display
of TF or ZPK models. One exception is the specification of discrete-time
transfer functions with tf (see tf for details).
Note that tf produces the same result as filt when the Variable property is set to 'z^-1' or 'q'.
Finally, the StateName property is analogous to the InputName and OutputName properties and keeps track of the state names in state-space models.
There are three ways to specify LTI property values:
You can set properties when creating LTI models with tf, zpk, ss, or frd.
You can set or modify the properties of an existing LTI model with set.
You can also set property values using structure-like assignments.
This section discusses the first two options. See Direct Property Referencing Using Dot Notation for details on the third option.
The function set for LTI objects follows the same syntax as its Handle Graphics counterpart. Specifically, each property is updated by a pair of arguments
PropertyName,PropertyValue
where
PropertyName is a string specifying the property name. You can type the property name without regard for the case (upper or lower) of the letters in the name. Actually, you need only type any abbreviation of the property name that uniquely identifies the property. For example, 'user' is sufficient to refer to the Userdata property.
PropertyValue is the value to assign to the property (see set for details on admissible property values).
As an illustration, consider the following simple SISO model for a heating system with an input delay of 0.3 seconds, an input called "energy," and an output called "temperature."
A Simple Heater Model

You can use a TF object to represent this delay system, and specify the time delay, the input and output names, and the model history by setting the corresponding LTI properties. You can either set these properties directly when you create the LTI model with tf, or by using the set command.
For example, you can specify the delay directly when you create the model, and then use the set command to assign InputName, OutputName, and Notes to sys.
sys = tf(1,[1 1],'Inputdelay',0.3); set(sys,'inputname','energy','outputname','temperature',... 'notes','A simple heater model')
Finally, you can also use the set command to obtain a listing of all setable properties for a given LTI model type, along with valid values for these properties. For the transfer function sys created above
set(sys)
produces
num: Ny-by-Nu cell array of row vectors (Nu = no. of inputs) den: Ny-by-Nu cell array of row vectors (Ny = no. of outputs) ioDelay: Ny-by-Nu array of delays for each I/O pair Variable: [ 's' | 'p' | 'z' | 'z^-1' | 'q' ] Ts: Scalar (sample time in seconds) InputDelay: Nu-by-1 vector OutputDelay: Ny-by-1 vector InputName: Nu-by-1 cell array of strings OutputName: Ny-by-1 cell array of strings InputGroup: structure with one field per channel group. OutputGroup: structure with one field per channel group. Name: String Notes: Text UserData: Arbitrary
You access the property values of an LTI model sys with get. The syntax is
PropertyValue = get(sys,PropertyName)
where the string PropertyName is either the full property name, or any abbreviation with enough characters to identify the property uniquely. For example, typing
h = tf(100,[1 5 100],'inputname','voltage',...
'outputn','current',...
'notes','A simple circuit')
get(h,'notes')
produces
ans =
'A simple circuit'
To display all of the properties of an LTI model sys (and their values), use the syntax get(sys). In this example,
get(h)
produces
num: {[0 0 100]}
den: {[1 5 100]}
ioDelay: 0
Variable: 's'
Ts: 0
InputDelay: 0
OutputDelay: 0
InputName: {'voltage'}
OutputName: {'current'}
InputGroup: [1x1 struct]
OutputGroup: [1x1 struct]
Name: ''
Notes: {'A simple circuit'}
UserData: []
Notice that default (output) values have been assigned to any LTI properties in this list that you have not specified.
Finally, you can also access property values using direct structure-like referencing. This topic is explained in Direct Property Referencing Using Dot Notation
An alternative way to query/modify property values is by structure-like referencing. Recall that LTI objects are basic MATLAB structures except for the additional flag that marks them as TF, ZPK, SS, or FRD objects (see LTI Objects). The field names for LTI objects are the property names, so you can retrieve or modify property values with the structure-like syntax.
PropertyValue = sys.PropertyName % gets property value sys.PropertyName = PropertyValue % sets property value
These commands are respectively equivalent to
PropertyValue = get(sys,'PropertyName') set(sys,'PropertyName',PropertyValue)
For example, type
sys = ss(1,2,3,4,'InputName','u'); sys.a
and you get the value of the property "a" for the state-space model sys.
ans =
1
Similarly,
sys.a = -1;
resets the state transition matrix for sys to -1.
Unlike standard MATLAB structures, you do not need to type the entire field name or use upper-case characters. You only need to type the minimum number of characters sufficient to identify the property name uniquely. Thus either of the commands
sys.InputName sys.inputn
produces
ans =
'u'
Any valid syntax for structures extends to LTI objects. For
example, given the TF model
![]()
h = tf(1,[1,0],'variable','p');
you can reset the numerator to
by typing
h.num{1} = [1 2];
or equivalently, with
h.num{1}(2) = 2;
By reading this section, you can learn more about using the Ts, InputName, OutputName, InputGroup, and OutputGroup LTI properties through a set of examples. For basic information on Notes and Userdata, see Generic LTI Properties. For detailed information on the use of InputDelay, OutputDelay, ioDelay, and InternalDelay, see Time Delays.
The sample time property Ts is used to specify the sampling period (in seconds) for either discrete-time or discretized continuous-time LTI models. Suppose you want to specify
![]()
as a discrete-time transfer function model with a sampling period of 0.5 seconds. To do this, type
h = tf([1 0],[2 1 1],0.5);
This sets the Ts property to the value 0.5, as is confirmed by
h.Ts
ans =
0.5000
For continuous-time models, the sample time property Ts is 0 by convention. For example, type
h = tf(1,[1 0]);
get(h,'Ts')
ans =
0
To leave the sample time of a discrete-time LTI model unspecified,
set Ts to
. For example,
h = tf(1,[1 -1],-1)
produces
Transfer function: 1 ----- z - 1 Sampling time: unspecified
The same result is obtained by using the Variable property.
h = tf(1,[1 -1],'var','z')
In operations that combine several discrete-time models, all specified sample times must be identical, and the resulting discrete-time model inherits this common sample time. The sample time of the resultant model is unspecified if all operands have unspecified sample times. With this inheritance rule for Ts, the following two models are equivalent.
tf(0.1,[1 -1],0.1) + tf(1,[1 0.5],-1)
and
tf(0.1,[1 -1],0.1) + tf(1,[1 0.5],0.1)
Note that
tf(0.1,[1 -1],0.1) + tf(1,[1 0.5],0.5)
returns an error message.
??? Error using ==> lti/plus In SYS1+SYS2, both models must have the same sample time.
You can use the InputName and OutputName properties (in short, I/O names) to assign names to any or all of the input and output channels in your LTI model.
For example, you can create a SISO model with input thrust, output velocity,
and transfer function
by typing
h = tf(1,[1 10]);
set(h,'inputname','thrust','outputname','velocity',...
'variable','p')
Equivalently, you can set these properties directly by typing
h = tf(1,[1 10],'inputname','thrust',...
'outputname','velocity',...
'variable','p')
This produces
Transfer function from input "thrust" to output "velocity": 1 ------ p + 10
Note how the display reflects the input and output names and the variable selection.
In the MIMO case, use cell vectors of strings to specify input or output channel names. For example, type
num = {3 , [1 2]};
den = {[1 10] , [1 0]};
H = tf(num,den); % H(s) has one output and two inputs
set(H,'inputname',{'temperature' ; 'pressure'})
The specified input names appear in the display of H.
Transfer function from input "temperature" to output: 3 ------ s + 10 Transfer function from input "pressure" to output: s + 2 ----- s
To leave certain names undefined, use the empty string '' as in
H = tf(num,den,'inputname',{ 'temperature' ; '' })
In many applications, you may want to create several (distinct or intersecting) groups of input or output channels and name these groups. For example, you may want to label one set of input channels as noise and another set as controls.
To see how input and output groups (I/O groups) work:
Create a random state-space model with one state, three inputs, and three outputs.
Assign the first two inputs to a group named controls, the first output to a group named temperature, and the last two outputs to a group named measurements. Note that both InputGroup and OutputGroup are structures.
To do this, type
h = rss(1,3,3); h.InputGroup.controls=[1 2]; h.OutputGroup.temperature = [1]; h.OutputGroup.measurements = [2 3]; h
These commands result in a state-space model of the following form.
a =
x1 x2 x3
x1 -2.809 1.967 -1.82
x2 -2.432 -2.042 0.8313
x3 1.125 1.655 -1.017
b =
u1 u2 u3
x1 -0.7829 0.4801 0
x2 0 0.6682 2.309
x3 -0.2512 -0.07832 0.5246
c =
x1 x2 x3
y1 -0.01179 0 -0.2762
y2 0.9131 0.4855 1.276
y3 0.05594 -0.005005 1.863
d =
u1 u2 u3
y1 -0.5226 0 0
y2 0.1034 0 0.2617
y3 -0.8076 0 0
Input groups:
Name Channels
controls 1,2
Output groups:
Name Channels
temperature 1
measurements 2,3
Continuous-time model.
Similarly, you can add or delete channels from an existing input or output group by redefining the group members, For example,
h.OutputGroup.temperature=[1 2]
adds the second output to the temperature group. To delete a channel from a group, just respecify it. For example,
h.OutputGroup.temperature=[1]
restores the original temperature group by deleting output #2 from the group.
![]() | Creating LTI Models | Model Conversion | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |