Using Simulink Previous page   Next Page

Signal Dimensions

Simulink blocks can output one- or two-dimensional signals. A one-dimensional (1-D) signal consists of a stream of one-dimensional arrays output at a frequency of one array (vector) per simulation time step. A two-dimensional (2-D) signal consists of a stream of two-dimensional arrays emitted at a frequency of one 2-D array (matrix) per block sample time. The Simulink user interface and documentation generally refer to 1-D signals as vectors and 2-D signals as matrices. A one-element array is frequently referred to as a scalar. A row vector is a 2-D array that has one row. A column vector is a 2-D array that has one column.

Simulink blocks vary in the dimensionality of the signals they can accept or output during simulation. Some blocks can accept or output signals of any dimensions. Some can accept or output only scalar or vector signals. To determine the signal dimensionality of a particular block, see the block's description in Simulink Blocks in the online Simulink Help. See Determining Output Signal Dimensions for information on what determines the dimensions of output signals for blocks that can output nonscalar signals.

Complex Signals

The values of Simulink signals can be complex numbers. A signal whose values are complex numbers is called a complex signal. You can introduce a complex-valued signal into a model in the following ways:

You can manipulate complex signals via blocks that accept them. If you are not sure whether a block accepts complex signals, see the documentation for the block in the "Simulink Blocks" section of the Simulink online documentation.

Virtual Signals

A virtual signal is a signal that represents another signal graphically. Some blocks, such as Bus Creator, Inport, and Outport blocks (see Virtual Blocks), generate virtual signals either exclusively or optionally (see Virtual Versus Nonvirtual Buses). Virtual signals are purely graphical entities. They have no mathematical or physical significance. Simulink ignores them when simulating a model.

Whenever you run or update a model, Simulink determines the nonvirtual signal(s) represented by the model's virtual signal(s), using a procedure known as signal propagation. When running the model, Simulink uses the corresponding nonvirtual signal(s), determined via signal propagation, to drive the blocks to which the virtual signals are connected.

Consider, for example, the following model.

The signals driving Gain blocks G1 and G2 are virtual signals corresponding to signals s2 and s1, respectively. Simulink determines this automatically whenever you update or simulate the model.

The Show propagated signals option (see Signal Properties Dialog Box) displays the nonvirtual signals represented by virtual signals in the labels of the virtual signals.

Control Signals

A control signal is a signal used by one block to initiate execution of another block, e.g., a function-call or action subsystem. When you update or start simulation of a block diagram, Simulink uses a dash-dot pattern to redraw lines representing the diagram's control signals as illustrated in the following example.

Signal Buses

A bus is a composite signal comprising a set of signals represented graphically by a bundle of lines. It is analogous to a bundle of wires held together by tie wraps. The components of a bus can have different data types and can themselves be composite signals (i.e., buses or muxed signals). You can use Bus Creator and Inport blocks to create signal buses and Bus Selector blocks to access a bus's components.

Selecting a bus and then Signal Dimensions from the model editor's Format menu displays the number of signal components carried by the bus.

Virtual Versus Nonvirtual Buses

Buses may be either virtual or nonvirtual. During simulation, blocks connected to a virtual bus read their inputs from memory allocated to the component signals, which may reside in noncontiguous areas of memory. By contrast, blocks connected to a nonvirtual bus read their inputs from a copy of the component signals maintained by Simulink in a contiguous area of memory allocated to the bus.

Some Simulink features, such as model referencing (see Referencing Models), require use of nonvirtual buses. Others require virtual buses. Nonvirtual buses also facilitate code generation by enabling buses to be represented as data structures. In general, virtual buses can save memory where nonvirtual buses are not required.

The Bus Creator and Inport blocks output virtual buses by default. To cause them to output a nonvirtual bus, select the Output as structure option on their parameter dialog boxes. You can also use the Signal Conversion block to convert nonvirtual to virtual buses, and vice versa.

Bus-Capable Blocks

A bus-capable block is a block through which both virtual and nonvirtual buses can pass. All virtual blocks are bus capable. Further, the following nonvirtual blocks are also bus-capable:

Some bus-capable blocks impose constraints on bus propagation through them. See the documentation for the individual blocks for more information.

Connecting Buses to Subsystem Inports

Generally, an Inport block is a virtual block and hence accepts a bus as input. However, an Inport block is nonvirtual if it resides in a conditionally executed or atomic subsystem and it or any of its components is directly connected to an output of the subsystem. In such a case, the Inport block can accept a bus only if its components have the same data type. If the components are of differing data types, attempting to simulate the model causes Simulink to halt the simulation and display an error message. You can avoid this problem, without changing the semantics of your model, by inserting a Signal Conversion block between the Inport block and the Outport block to which it was originally connected.

Consider, for example, the following model.

In this model, the Inport labeled nonvirtual is nonvirtual because it resides in an atomic subsystem and one of its components (labeled a) is directly connected to one of the subsystem's outputs. Further, the bus connected to the subsystem's inputs has components of differing data types. As a result, Simulink cannot simulate this model.

Inserting a Signal Conversion block with the bus copy option selected breaks the direct connection to the subsystem's output and hence enables Simulink to simulate the model.

Connecting Buses to Model Inports

If you want a root level Inport of a model to be able to accept a bus signal, you must set the Inport's bus object parameter to the name of a bus object that defines the type of bus that the Inport accepts. See Working with Data Objects and Simulink.Bus class for more information.


Previous page  Signal Basics Checking Signal Connections Next page

© 1994-2005 The MathWorks, Inc.