| Creating and Manipulating Models | ![]() |
Additional Insight into LTI Properties
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, and ioDelay, see Time Delays.
Sample Time
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
This sets the Ts property to the value 0.5, as is confirmed by
For continuous-time models, the sample time property Ts is 0 by convention. For example, type
To leave the sample time of a discrete-time LTI model unspecified, set Ts to
. For example,
The same result is obtained by using the Variable property.
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.
Caution. Resetting the sample time of a continuous-time LTI model sys from zero to a nonzero value does not discretize the original model sys. The command
only affects the Ts property and does not alter the remaining model data. Use c2d and d2c to perform continuous-to-discrete and discrete-to-continuous conversions. For example, use
to discretize a continuous system sys at a 10Hz sampling rate.
Use d2d to change the sample time of a discrete-time system and resample it.
Input Names and Output Names
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
Equivalently, you can set these properties directly by typing
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
Input Groups and Output Groups
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:
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.
h = rss(1,3,3); h.InputGroup.controls=[1 2]; h.OutputGroup.temperature = [1]; h.OutputGroup.measurements = [2 3]; h
and MATLAB returns 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,
adds the second output to the temperature group. To delete a channel from a group, just respecify it. For example,
restores the original temperature group by deleting output #2 from the group.
| Direct Property Referencing Using Dot Notation | Model Conversion | ![]() |
© 1994-2005 The MathWorks, Inc.