Quantcast

Documentation Center

  • Trial Software
  • Product Updates

Signal Values

Signal Data Types

Data type refers to the format used to represent signal values internally. By default, the data type of Simulink® signals is double. You can create signals of other data types. Simulink signals support the same range of data types as MATLAB®. See Data Types for more information.

Signal Dimensions, Size, and Width

Simulink blocks can output one-dimensional, two-dimensional, or multidimensional signals. The Simulink user interface and documentation generally refer to 1-D signals as vectors and 2-D or multidimensional signals as matrices. A one-element array is frequently referred to as a scalar.

The size of a signal refers to the number of elements that a signal contains. The size of a matrix (2-D) signal is generally expressed as M-by-N, where M is the number of columns and N is the number of rows making up the signal. The size of a vector signal is referred to as the width of the signal.

For more information, see Signal Dimensions.

Complex Signals

The values of signals can be complex numbers or real numbers. A signal whose values are complex numbers is a complex signal. Create a complex-valued signal using one of the following approaches:

  • Load complex-valued signal data from the MATLAB workspace into the model via a root-level Inport block.

  • Create a Constant block in your model and set its value to a complex number.

  • Create real signals corresponding to the real and imaginary parts of a complex signal, then combine the parts into a complex signal, using the Real-Imag to Complex conversion block.

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.

Initializing Signal Values

If a signal does not have an explicit initial value, the initial value that Simulink uses depends on the data type of the signal.

Signal Data TypeDefault Initial Value
Numeric (other than fixed-point)Zero
Fixed-pointGround value
BooleanFalse
EnumeratedDefault value

You can specify the non-default initial values of signals for Simulink to use at the beginning of simulation.

  • For any signal, you can define a signal object (Simulink.Signal), and use that signal object to specify an initial value for the signal.

  • For some blocks, such as Outport, Data Store Memory, and Memory, you can use either a signal object or a block parameter, or both, to specify the initial value of a block state or output.

For details, see Initialize Signals and Discrete States.

Viewing Signal Values

You can use either blocks or the signal viewers (such as the Signal & Scope Manager) to display the values of signals during a simulation. For example, you can use either the Scope block or the Signal & Scope Manager to graph time-varying signals on an oscilloscope-like display during simulation. For general information about options for viewing signal values, see View Simulation Results. For detailed information about:

Displaying Signal Values in Model Diagrams

To include graphical displays of signal values in a model diagram, use one of the following approaches:

Display Data Tips During Simulation

For many blocks, Simulink can display block output (port values) as data tips on the block diagram while a simulation is running.

  1. In the Simulink Editor, select Display > Data Display in Simulation.

  2. From the submenu, select either Show Value Labels When Hovering or Show Value Labels When Clicked.

  3. To change display options, use the Options submenu.

For details, see Display Port Values for Debugging.

Display Signal Value After Simulation

To display, below a specific signal, the signal value after simulation:

  1. Right-click the signal.

  2. In the context menu, select Show Value Label of Selected Port.

Exporting Signal Data

You can save signal values to the MATLAB workspace during simulation, for later retrieval and postprocessing. For a summary of different approaches, see Approaches for Exporting Signal Data.

Was this topic helpful?