|On this page…|
A signal is a time varying quantity that has values at all points in time. You can specify a wide range of signal attributes, including:
Data type (for example, 8-bit, 16-bit, or 32-bit integer)
Numeric type (real or complex)
Dimensionality (one-dimensional, two-dimensional, or multidimensional array)
Many blocks can accept or output signals of any data or numeric type and dimensionality. Other blocks impose restrictions on the attributes of the signals that they can handle.
In Simulink®, signals are the outputs of dynamic systems represented by blocks in a Simulink diagram and by the diagram itself. The lines in a block diagram represent mathematical relationships among the signals defined by the block diagram. For example, a line connecting the output of block A to the input of block B indicates that the signal output of B depends on the signal output of A.
Simulink block diagrams represent signals with lines that have an arrowhead. The source of the signal corresponds to the block that writes to the signal during evaluation of its block methods (equations). The destinations of the signal are blocks that read the signal during the evaluation of the block methods (equations).
Note Simulink signals do not travel along the lines that connect blocks in the same way that electrical signals travel along a wire. This analogy is misleading because it suggests that a block diagram represents physical connections between blocks, which is not the case. Simulink signals are mathematical, not physical, entities, and the lines in a block diagram represent mathematical, not physical, relationships among blocks.
Create a signal by adding a source block to your model. For example, you can create a signal that varies sinusoidally with time, by dragging an instance of the Sine block from the Simulink Sources library into your model. See Sources for information about blocks that create signals in a model.
You can also use the Signal & Scope Manager to create signals in your model, without using blocks. See Signal and Scope Manager for more information.
A Simulink model can include many different types of signals. For details, see Signal Types.
Simulink uses a variety of line styles to display different types of signals in the model window. Assorted line styles help you to differentiate the signal types.
|Signal Type||Line Style||Description|
|Scalar and Nonscalar||Simulink uses a thin, solid line to represent scalar and nonscalar signals.|
|Nonscalar (optional)||When you enable the Wide nonscalar lines option, Simulink uses a thick, solid line to represent nonscalar signals. For information about line display options, see Display Signal Attributes.|
|Simulink uses a thin, dash-dot line to represent control signals.|
|Virtual Bus||Simulink uses a triple line with a solid core to represent virtual signal buses.|
|Nonvirtual Bus||Simulink uses a triple line with a dotted core to represent nonvirtual signal buses.|
|Array of Buses||Simulink uses a heavy triple line with a dotted core to represent array of bus signals.|
|Variable-Size||Simulink uses a solid wide line with a white dotted core to represent a variable-size signal.|
Other than using the Wide nonscalar lines option to display nonscalar signals as thick, solid lines, you cannot customize or control the line style of signals. See Wide Nonscalar Lines for more information about this option.
As you construct a block diagram, Simulink uses a thin, solid line to represent all signal types. After you update or start simulation of the block diagram, Simulink redraws the lines, using the specified line styles.
Use the Signal Properties dialog box to specify properties for:
Signal names and labels
Simulink Coder™ to use to generate code
Documentation of the signal
To open the Signal Properties dialog box, right-click a signal and choose Properties.
Displaying signal attributes in the model diagram can make the model easier to understand at a glance. For example, in the Simulink Editor, use the Display > Signals & Ports menu to include in the model layout information about signal attributes, such as:
Port data types
For details, see Display Signal Attributes.
To highlight a signal and its source or destination blocks:
Right-click a signal.
In the context menu, select either Highlight Signal to Source or Highlight Signal to Destination.
For details, see Display Signal Sources and Destinations.
You can perform the following kinds of tests on signals:
For many Simulink blocks, you can specify a range of valid values for the output signals. Simulink provides a diagnostic for detecting when blocks generate signals that exceed their specified ranges during simulation. For details, see Signal Ranges.
Many Simulink blocks have limitations on the types of signals that they accept. Before simulating a model, Simulink checks all blocks to ensure that the blocks can accommodate the types of signals output by the ports to which the blocks connect. If any incompatibilities exist, Simulink reports an error and terminates the simulation.
To detect signal compatibility errors before running a simulation, update the diagram. In the Simulink Editor, select Simulation > Update Diagram.
The Signal Builder block displays interchangeable groups of signal sources. Use the Signal Builder to create or edit groups of signals and to switch the groups into and out of a model.
Signal groups can greatly facilitate testing a model, especially when you use them in conjunction with Simulink Assertion blocks and the Model Coverage Tool in the Simulink Verification and Validation product.
For details, see Signal Groups.