Investigate Signal Values
While transmitting valuable data about a model and between the blocks, signals may take different values. In this section, you learn how to initialize, display signals as well as more information on the data types and dimensions a signal can take.
Initialize 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 Type||Default Initial Value|
|Numeric (other than fixed-point)||Zero|
|Fixed-point||Real-world ground 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 details, see Initialize Signals and Discrete States.
View 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 Scope Blocks and Scope Viewer Overview. For detailed information about:
Blocks that you can use to display signals in a model, see Sinks
Signal viewers, Floating Scope and Scope Viewer Tasks
The Signal & Scope Manager, see Viewers and Generators Manager
Display 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.
In the Simulink Editor, on the Debug tab, select Output Values , go to the Signal tab, and toggle on the Output Value Label > Toggle Value Displays button.
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:
Right-click the signal.
In the context menu, select Show Value Label of Selected Port.
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 About Data Types in Simulink for more information.
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.
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 Logging Simulation Data.