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 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,

produces

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.

and

Note that

returns an error message.

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

This produces

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

The specified input names appear in the display of H.

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:

  1. Create a random state-space model with one state, three inputs, and three outputs.
  2. 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.

To do this, type

and MATLAB returns a state-space model of the following form.

Notice that the middle column of the I/O group listing indicates whether the group is an input group (I) or an output group (O).

In general, to specify M input groups (or output groups), you need an M-by-2 cell array organized as follows.

Figure 1-2: Two Column Cell Array

When you specify the cell array for input (or output) groups, keep in mind:

For example,

adds another input group called disturbance to h.

You can use regular cell array syntax for accessing or modifying I/O group components. For example, to delete the first output group, temperature, type

Similarly, you can add or delete channels from an existing input or output group. Recalling that input group channels are stored in the first column of the corresponding cell array, to add channel three to the input group controls, type

or, equivalently,


  Direct Property Referencing Model Conversion