Display signals generated during simulation
Simulink / Commonly Used Blocks
Simulink / Sinks
HDL Coder / Commonly Used Blocks
HDL Coder / Sinks
The Simulink® Scope block and DSP System Toolbox™ Time Scope block display time domain signals.
The two blocks have identical functionality, but different default settings. The Time Scope is optimized for discrete time processing. The Scope is optimized for general time-domain simulation. For a side-by-side comparison, see Simulink Scope Versus DSP System Toolbox Time Scope.
Oscilloscope features:
Triggers — Set triggers to sync repeating signals and pause the display when events occur.
Cursor Measurements — Measure signal values using vertical and horizontal cursors.
Signal Statistics — Display the maximum, minimum, peak-to-peak difference, mean, median, and RMS values of a selected signal.
Peak Finder — Find maxima, showing the x-axis values at which they occur.
Bilevel Measurements — Measure transitions, overshoots, undershoots, and cycles.
You must have a Simscape™ or DSP System Toolbox license to use the Peak Finder, Bilevel Measurements, and Signal Statistics.
Scope display features:
Simulation control — Debug models from a Scope window using Run, Step Forward, and Step Backward toolbar buttons.
Multiple signals — Plot multiple signals on the same y-axis (display) using multiple input ports.
Multiple y-axes (displays) — Display multiple y-axes. All the y-axes have a common time range on the x-axis.
Modify parameters — Modify scope parameter values before and during a simulation.
Axis autoscaling — Autoscale axes during or at the end of a simulation. Margins are drawn at the top and bottom of the axes.
Display data after simulation — Scope data is saved during a simulation. If a scope is closed at the start of a simulation, when you open the scope after a simulation, the scope displays simulation results for attached input signals.
Note
If you have a high sample rate or long simulation time, you may run into issues with memory or system performance because the scope saves data internally. To limit the amount of data saved for scope visualization, use the Limit data points to last property.
For information on controlling a scope programmatically, see Control Scope Blocks Programmatically.
Do not use scope blocks in a Library. If you place a scope block inside a library block with a locked link or in a locked library, Simulink displays an error when trying to open the scope window. To display internal data from a library block, add an output port to the library block, and then connect the port to a Scope block in your model.
If you step through a model, the scope only updates when the scope block runs. This means that the time shown in the status bar may not match the model time.
When connected to a constant signal, a scope block may plot a single point.
The scope shows gaps in the display when the
signal value is NaN
.
When you visualize multiple frame-based signals in the scope, some samples of signals with a frame size of 1 might not be displayed. To visualize these signals, move the signals with frame size of 1 to a separate scope.
Scope displays have limitations in Rapid Accelerator mode. See Behavior of Scopes and Viewers with Rapid Accelerator Mode
When the Scope is in a ForEach subsystem, the scope only displays the last index.
Port_1
— Signal or signals to visualizeConnect the signals you want to visualize. You can have up to 96 input ports. Input signals can have these characteristics:
Type — Continuous (sample-based) or discrete (sample-based and frame-based).
Data type — Any data type that Simulink supports. See Data Types Supported by Simulink.
Dimension — Scalar, one dimensional (vector), two dimensional (matrix), or multidimensional (array). Display multiple channels within one signal depending on the dimension. See Signal Dimensions and Determine Signal Dimensions.
When the input is a constant signal, the scope plots a single point.
The scope shows gaps in the display when the signal value is
NaN
.
When you visualize multiple frame-based signals in the scope, some samples of signals with a frame size of 1 might not be displayed. To visualize these signals, move the signals with frame size of 1 to a separate scope.
You can connect nonvirtual bus and arrays of bus signals to a scope. To display the bus signals, use normal or accelerator simulation mode. The scope displays each bus element signal in the order the elements appear in the bus, from the top to the bottom. Nested bus elements are flattened.
To log nonvirtual bus signals with a scope, set the Save
format parameter to Dataset
.
You can use any Save format to log virtual bus
signals.
Data Types: single
| double
| half
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| Boolean
| fixed point
| enumerated
| bus
Complex Number Support: Yes
The Configuration Properties dialog box controls various properties about the scope displays. From the scope menu, select View > Configuration Properties.
MainOpen at simulation start
— Specify when scope window opensSelect this check box to open the scope window when simulation starts.
Display the full path
— Display block path on scope title barSelect this check box to display the block path in addition to the block name.
Number of input ports
— Number of input ports on scope blockSpecify number of input ports on a Scope block, specified as an integer. The maximum number of input ports is 96.
See NumInputPorts
.
Layout
— Number and arrangement of displaysm
-by-n
axesSpecify number and arrangement of displays. The maximum layout is 16 rows by 16 columns.
To expand the layout grid beyond 4 by 4, click within the dialog box and drag. Maximum of 16 rows by 16 columns.
If the number of displays is equal to the number of ports, signals from each port appear on separate displays. If the number of displays is less than the number of ports, signals from additional ports appear on the last display. For layouts with multiple columns and rows, ports are mapped down then across.
See LayoutDimensions
.
Sample time
— Simulation interval between scope updates-1
(for inherited) (default) | positive real numberSpecify the time interval between updates of the scope display. This property does not apply to floating scopes and scope viewers.
See SampleTime
.
Input processing
— Channel or element signal processingElements as channels (sample based)
(default for Scope) | Columns as channels (frame based)
(default for Time Scope)Elements as channels (sample
based)
- Process each element as a
unique sample.
Columns as channels (frame
based)
- Process signal values in a
channel as a group of values from multiple time
intervals. Frame-based processing is available
only with discrete input signals.
See FrameBasedProcessing
.
Maximize axes
— Maximize size of plotsOff
(default for Scope) | Auto
(default for Time
Scope) | On
Time span
— Length of x-axis to displayAuto
(default) | User defined
| One frame
period
Auto
— Difference between the simulation start and stop times.
The block calculates the beginning and end times of the time range using the Time display offset and Time span properties. For example, if you
set the Time display offset to 10
and the Time
span to 20
, the scope sets the time range from 10
to
30
.
User defined
— Enter any value less than the total simulation time.
One frame period
— Use the frame period of the
input signal to the Time Scope block. This option is only available when the
Input processing parameter is set to
Columns as channels (frame based)
.
See TimeSpan
.
Time span overrun action
— Display data beyond visible x-axisWrap
(default) | Scroll
Specify how to display data beyond the visible x-axis range.
You can see the effects of this option only when plotting is slow with large models or small step sizes.
Wrap
— Draw a full screen of data from left to right, clear the screen, and
then restart drawing the data from the left.
Scroll
— Move data to the left as new data is drawn on the right. This mode
is graphically intensive and can affect run-time performance.
Time display offset
— x-axis offset0
(default) | scalar | vectorOffset the x-axis by a specified time value, specified as a real number or vector of real numbers.
For input signals with multiple channels, you can enter a scalar or vector:
Scalar — Offset all channels of an input signal by the same time value.
Vector — Independently offset the channels.
See TimeDisplayOffset
.
Time-axis labels
— Display of x-axis labelsBottom Displays Only
(default for Scope) | All
(default for Time Scope) | None
Specify how x-axis (time) labels display:
All
— Display x-axis labels on all
y-axes.
None
— Do not display labels. Selecting None
also
clears the Show time-axis label check box.
Bottom displays only
— Display x-axis label on the bottom
y-axis.
To enable this property, set:
Show time-axis label to on.
Maximize axes to off.
The Active display property determines which display is affected.
See TimeAxisLabels
.
Show time-axis label
— Display or hide x-axis labelsSelect this check box to show the x-axis label for the active display
To enable this property, set Time-axis labels
to All
or Bottom Displays
Only
.
The Active display property determines which display is affected.
See ShowTimeAxisLabel
.
Active display
— Selected display1
(default) | positive integerSelected display. Use this property to control which display is changed when changing style properties and axes-specific properties.
Specify the desired display using a positive integer that corresponds to the column-wise placement index. For layouts with multiple columns and rows, display numbers are mapped down and then across.
See ActiveDisplay
.
Title
— Display name%<SignalLabel>
(default) | stringTitle for a display. The default value %<SignalLabel>
uses the input signal name for
the title.
The Active display property determines which display is affected.
See Title
.
Show legend
— Display signal legendToggle signal legend. The names listed in the legend are the signal names from the model. For signals with multiple channels, a channel index is appended after the signal name. Continuous signals have straight lines before their names, and discrete signals have step-shaped lines.
From the legend, you can control which signals are visible. This control is equivalent to changing the visibility in the Style properties. In the scope legend, click a signal name to hide the signal in the scope. To show the signal, click the signal name again. To show only one signal, right-click the signal name, which hides all other signals. To show all signals, press Esc.
Note
The legend only shows the first 20 signals. Any additional signals cannot be controlled from the legend.
The Active display property determines which display is affected.
See ShowLegend
.
Show grid
— Show internal grid linesSelect this check box to show grid lines.
The Active display property determines which display is affected.
See ShowGrid
.
Plot signals as magnitude and phase
— Split display into magnitude and phase plotsOn — Display magnitude and phase plots. If the signal is real, plots the absolute value of the signal for the magnitude. The phase is 0 degrees for positive values and 180 degrees for negative values. This feature is useful for complex-valued input signals. If the input is a real-valued signal, selecting this check box returns the absolute value of the signal for the magnitude.
Off — Display signal plot. If the signal is complex, plots the real and imaginary parts on the same y-axis.
The Active display property determines which display is affected.
See PlotAsMagnitudePhase
.
Y-limits (Minimum)
— Minimum y-axis value-10
(default) | real scalarSpecify the minimum value of the y-axis as a real number.
Tunable: Yes
If you select Plot signals as magnitude and phase, this property only applies to the
magnitude plot. The y-axis limits of the phase plot are always [-180
180]
.
The Active display property determines which display is affected.
See YLimits
.
Y-limits (Maximum)
— Maximum y-axis value10
(default) | real scalarSpecify the maximum value of the y-axis as a real number.
Tunable: Yes
If you select Plot signals as magnitude and phase, this property only applies to the
magnitude plot. The y-axis limits of the phase plot are always [-180
180]
.
The Active display property determines which display is affected.
See YLimits
.
Y-label
— Y-axis labelAmplitude
(default for Time Scope) | stringSpecify the text to display on the y-axis. To display signal units, add
(%<SignalUnits>)
to the label. At the beginning of a simulation, Simulink replaces (%SignalUnits)
with the units associated with the signals.
Example: For a velocity signal with units of m/s
, enter Velocity
(%<SignalUnits>)
.
If you select Plot signals as magnitude and phase, this property does not apply. The
y-axes are labeled Magnitude
and Phase
.
The Active display property determines which display is affected.
See YLabel
.
Limit data points to last
— Limit buffered data values5000
(default) | on | positive integerLimit data saved by the scope internally. By default all data points are
saved so that you can view the scope visualization after the simulation
finishes. For simulations with Stop time set to
inf
, consider selecting Limit data points
to last.
Note
If you do not select Limit data points to last and you have a high sample rate or long simulation time, you may run into issues with memory or system performance.
When you select this property, the scope saves the latest n data points, where n the specified number of data points.
Off — Save and plot all data values.
On — Save specified number of data values for each signal. If the signal is frame-based, the number of buffered data values is the specified number of data values multiplied by the frame size.
In some cases, selecting this property can have the effect of plotting signals for less than the entire time range of a simulation (for example if your sample time is small). If the scope plots a portion of your signals, consider increasing the number of data points to save.
This property limits the data values plotted in the scope and the data values saved to a MATLAB® variable specified in Variable name.
Decimation
— Reduce amount of scope data to display and save2
(default) | on | positive integerOn — Plot and log (save) scope data every N
th data point, where
N
is the decimation factor entered in the text box. A value of
1
buffers all data values.
Off — Save all scope data values.
To enable this property, select Log data to workspace.
This property limits the data values plotted in the scope and the data values saved to a MATLAB variable specified in Variable name.
Log data to workspace
— Save data to MATLAB workspaceSelect this check box to enable logging and enable the Variable name, Save format, and Decimation properties. This property does not apply to floating scopes and scope viewers.
For an example of saving signals to the MATLAB Workspace using a Scope block, see Save Simulation Data Using Scope Block.
See DataLogging
.
Variable name
— Name of saved data variableScopeData
(default) | stringSpecify a variable name for saving scope data in the MATLAB workspace. This property does not apply to floating scopes and scope viewers.
To enable this property, select Log data to workspace.
Save format
— MATLAB variable formatDataset
(default) | Structure With Time
| Structure
| Array
Select variable format for saving data to the MATLAB workspace. This property does not apply to floating scopes and scope viewers.
Dataset
— Save data as a dataset object. Use the Dataset
signal format configuration parameter to select the dataset object. This format does
not support variable-size data, MAT-file logging, or external mode archiving. See Simulink.SimulationData.Dataset
.
Structure With Time
— Save data as a structure with associated time
information.
Structure
— Save data as a structure.
Array
— Save data as an array with associated time information. This
format does not support variable-size data.
To enable this property, select Log data to workspace.
The Axes Scaling dialog controls the axes limits of the scope. To open the Axes Scaling properties, in the scope menu, select Tools > Axes Scaling > Axes Scaling Properties.
Axes scaling
— Y-axis scaling modeManual
(default) | Auto
| After N Updates
Manual
— Manually scale the y-axis range with the
Scale Y-axis Limits toolbar button.
Auto
— Scale the y-axis range during and after simulation.
Selecting this option displays the Do not allow Y-axis limits to shrink Do not allow Y-axis limits to shrink check box. If you want the y-axis range to increase and decrease with the
maximum value of a signal, set Axes scaling to Auto
and
clear the Do not allow Y-axis limits to shrink check box.
After N Updates
— Scale y-axis after the number of time
steps specified in the Number of updates Number of updates
text box (10
by default). Scaling occurs only once during each run.
See AxesScaling
.
Do not allow Y-axis limits to shrink
— When y-axis limits can changeAllow y-axis range limits to increase but not decrease during a simulation.
To use this property, set Axes scaling Axes scaling
to Auto
.
Number of updates
— Number of updates before scaling10
(default) | integerSet this property to delay auto scaling the y-axis.
To use this property, set Axes scaling Axes scaling
to After N Updates
.
Scale axes limits at stop
— When y-axis limits can changeOn — Scale axes when simulation stops.
Off — Scale axes continually.
To use this property, set Axes scaling Axes scaling
to Auto
.
Y-axis Data range (%)
— Percent of y-axis to use for plotting80
(default) | integer between [1, 100]Specify the percentage of the y-axis range used for plotting
data. If you set this property to 100
, the plotted data uses
the entire y-axis range.
Y-axis Align
— Alignment along y-axisCenter
(default) | Top
| Bottom
Specify where to align plotted data along the y-axis data range when Y-axis Data range is set to less than 100 percent.
Top
— Align signals with the maximum values
of the y-axis range.
Center
— Center signals between the minimum
and maximum values.
Bottom
— Align signals with the minimum
values of the y-axis range.
Autoscale X-axis limits
— Scale x-axis range limitsScale x-axis range to fit all signal values. If Axes
scaling is set to Auto
, the data currently within
the axes is scaled, not the entire signal in the data buffer.
X-axis Data range (%)
— Percent of x-axis to use for plotting100
(default) | integer in the range [1, 100]Specify the percentage of the x-axis range to plot data on. For
example, if you set this property to 100
, plotted data uses
the entire x-axis range.
X-axis Align
— Alignment along x-axisCenter
(default) | Top
| Bottom
Specify where to align plotted data along the x-axis data range when X-axis Data range is set to less than 100 percent.
Top
— Align signals with the maximum values of
the x-axis range.
Center
— Center signals between the minimum and
maximum values.
Bottom
— Align signals with the minimum values
of the x-axis range.
To open the Style dialog box, from the scope menu, select View > Style.
Figure color
— Background color for windowBackground color for the scope.
Plot type
— How to plot signalAuto
(default for Scope) | Line
(default for Time Scope) | Stairs
| Stem
When you select Auto
, the plot type is a line graph for continuous signals, a
stair-step graph for discrete signals, and a stem graph for Simulink message signals.
Axes colors
— Background and axes color for individual displaysSelect the background color for axes (displays) with the first color palette. Select the grid and label color with the second color palette.
Preserve colors for copy to clipboard
— Copy scope without changing colorsSpecify whether to use the displayed color of the scope when copying.
When you select File > Copy to Clipboard, the software changes the color of the scope to be printer friendly (white background, visible lines). If you want to copy and paste the scope with the colors displayed, select this check box.
Properties for line
— Line to changeChannel 1
(default)Select active line for setting line style properties.
Visible
— Line visibilityShow or hide a signal on the plot.
The values of Active display and Properties for line determine which line is affected.
Line
— Line styleSelect line style, width, and color.
The values of Active display and Properties for line determine which line is affected.
Marker
— Data point marker styleNone
(default) | marker shapeSelect marker shape.
The values of Active display and Properties for line determine which line is affected.
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
[a] Virtual bus not supported. Nonvirtual bus supported only in normal and accelerator mode simulation. Data logging for nonvirtual bus supported only in the dataset format |
This block can be used for simulation visibility in systems that generate code, but is not included in the generated code.
This block can be used for simulation visibility in subsystems that generate HDL code, but is not included in the hardware implementation.
This block can be used for simulation visibility in systems that generate code, but is not included in the generated code.
This block accepts fixed-point input, but converts it to double
for
display.