Scope - Display signals generated during simulation - Simulink (original) (raw)

Display signals generated during simulation

Libraries:
Simulink / Commonly Used Blocks
Simulink / Sinks
HDL Coder / Commonly Used Blocks
HDL Coder / Sinks

Description

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 Block Versus DSP System Toolbox Time Scope Block.

Scope Tab

This screenshot highlights the important aspects of the scope window.

Scope display features:

Measurements Tab

This screenshot highlights the important aspects of the measurements window.

Here is a list of all the measurements the Scope block supports:

You must have a Simscape™ or DSP System Toolbox license to use the Peak Finder, Bilevel Measurements, and Signal Statistics.

For information on controlling a scope programmatically, see Control Scope Blocks Programmatically.

Examples

Limitations

Ports

Input

expand all

Connect the signals you want to visualize. You can have up to 96 input ports. Input signals can have these characteristics:

Input Limitations

Bus Support

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

Parameters

expand all

Scope Tab

Scope tab of the Scope block and the Time Scope block.

Settings > General

Select this parameter to open the scope when simulation starts.

Programmatic Use

See OpenAtSimulationStart.

Select this parameter to display the block path in addition to the block name.

Specify the number of input ports on the scope as a positive integer in the range [1 96].

Programmatic Use

See NumInputPorts.

Specify the dimensions of the display grid as a two-element numeric vector with each element greater than 0 and less than or equal to 16.

Programmatic Use

See LayoutDimensions.

Specify whether the block performs sample- or frame-based processing.

When you change the setting of theInput processing parameter, the scope clears the signal data and the measurements data (if any). Rerun the simulation to plot the signal data with the new setting. (since R2025a)

Programmatic Use

See FrameBasedProcessing.

Programmatic Use

See MaximizeAxes.

Settings > Time

Specify the time interval between updates of the scope display. This property does not apply to floating scopes and scope viewers. For a more detailed explanation of sample time with the scope, seeSample Time with Scope Blocks.

Programmatic Use

See SampleTime.

Specify the length of the _x_-axis to display as one of these:

Programmatic Use

See TimeSpan.

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.

Programmatic Use

See TimeSpanOverrunAction.

Specify the _x_-axis units as one of these options:

Programmatic Use

See TimeUnits.

Offset the _x_-axis by a specified time value, specified as a real number or a vector of real numbers.

For input signals with multiple channels, you can enter a scalar or vector:

Programmatic Use

See TimeDisplayOffset.

Specify how the _x_-axis (time) and tick labels display:

Dependencies

To enable this parameter:

Programmatic Use

See TimeAxisLabels.

Select this parameter to show the time offset on the status bar.

Select this parameter to show the _x_-axis label for the active display.

Dependencies

To enable this parameter, set T-axis and ticks labels to All orBottom displays only.

Programmatic Use

See ShowTimeAxisLabel.

Settings > Axes Scaling

Specify the _y_-axis scaling mode as one of these:

Programmatic Use

See AxesScaling.

Select this parameter to allow _y_-axis range limits to increase during simulation.

Dependencies

To use this parameter, set Scale Y-axis limits toAuto.

Set this property to delay auto scaling the_y_-axis.

Dependencies

To use this parameter, set Scale Y-axis limits toAfter N Updates.

Programmatic Use

See AxesScalingNumUpdates.

When you select this parameter, the scope scales the_y_-axis limits only when the simulation stops. When you clear this parameter, the scope scales the _y_-axis limits continuously.

Specify the percentage of the _y_-axis range used for plotting data. If you set this parameter to 100, the plotted data uses the entire _y_-axis range.

Specify where to align plotted data along the _y_-axis data range when Y-axis data range (%) is set to less than 100 percent.

Scale _x_-axis range to fit all signal values. IfScale Y-axis limits is set toAuto, the data currently within the axes is scaled, not the entire signal in the data buffer.

Specify the percentage of the _x_-axis range to plot data on. For example, if you set this parameter to 100, plotted data uses the entire _x_-axis range.

Dependencies

To enable this parameter, select Scale X-axis limits.

Specify where to align plotted data along the _x_-axis data range when X-axis data range (%) is set to less than 100 percent.

Dependencies

To enable this parameter, select Scale X-axis limits.

Settings > Logging

Select this property to limit data saved by the scope internally. When you select this property and set the Input processing parameter to:

n is the scalar value you specify in the Max points parameter.

When you select this parameter, the scope can plot signals for less than the entire time range of a simulation, for example, if the sample time is small. If the scope plots only a portion of the signal, consider increasing the number of data points to save.

When you clear this property, the scope saves all the data. You can visualize the entire data in the scope after the simulation finishes. For simulations with Stop Time set toinf, consider selecting this property.

Note

If you do not select this property and you have a high sample rate or long simulation time, you can run into issues with memory or system performance.

Programmatic Use

See DataLoggingLimitDataPoints.

Specify the maximum number of data points n to save as a positive integer. The scope saves the last n data points to a MATLAB variable specified in Variable name.

Dependencies

To enable this parameter, select the Limit data points to last or the Limit frames to last parameter.

Programmatic Use

See DataLoggingMaxPoints.

Select this property to plot and log (save) scope data every_N_th data point or frame, where N is the decimation factor you specify in the Decimation value parameter.

When you select this property and specify a scalar value in theDecimation value parameter, the scope limits the data values plotted and saved to a MATLAB variable specified in Variable name.

When you set the Input processing parameter to:

When you clear this property, the scope saves all the scope data.

Programmatic Use

See DataLoggingDecimateData and DataLoggingDecimation.

Specify the scope to save or log data every _N_th data point or frame, where N is the value you specify in this parameter.

A value of 1 buffers all the data values.

Dependencies

To enable this parameter, select Decimation orDecimate frames.

Programmatic Use

See DataLoggingDecimateData and DataLoggingDecimation.

Select this parameter to enable logging and to save the logged data to the MATLAB workspace. When you select this parameter, the scope enables the Variable name and Save format parameters as well. This parameter 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.

Programmatic Use

See DataLogging.

Specify a variable name for saving scope data in the MATLAB workspace. This parameter does not apply to floating scopes and scope viewers.

Dependencies

To enable this parameter, select Log data to workspace.

Programmatic Use

See DataLoggingVariableName.

Select the MATLAB variable format for saving data to the MATLAB workspace. This parameter does not apply to floating scopes and scope viewers.

Dependencies

To enable this parameter, select Log data to workspace.

Programmatic Use

See DataLoggingSaveFormat.

Settings > Axes Style

Specify the type of the plot as one of these:

Select the background color for the scope display.

Select the axes, grid, and label color for individual displays.

Select the background color for the scope window.

Select this parameter to preserve colors when copying the scope display to the clipboard. When you do not select this parameter, the scope changes the color of the scope to be printer friendly (white background, visible lines). To preserve the existing colors on the scope while copying, select this parameter.

Settings > Display Properties

Select the display which updates based on the settings in theDisplay Properties > Line Style, Y-axis, andDisplay.

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.

Dependencies

To enable this parameter, set the display grid to have more than one display, that is, set Display grid underSettings > General to a two-element numeric vector with at least one of the values greater than 1.

Programmatic Use

See ActiveDisplay.

Note

All the Line Style properties affect only the active display that you select through the Active Display parameter.

Settings > Line Style

Select the active line for setting line style properties.

Select the line style for the active line that you select using theLine parameter.

Specify the line width for the active line that you select using theLine parameter.

Specify a data point marker for the active line that you select using theLine parameter. This parameter is similar to the'Marker' property for plots. You can choose any of the marker symbols from the drop-down list.

Specify the line color for the active line that you select using theLine parameter.

Tunable: Yes

Show or hide a signal on the plot.

Select this parameter to display signal on the plot. If you clear this parameter, the signal you select is no longer visible.

Note

All the Y-axis properties affect only the active display that you select through the Active Display parameter.

Settings > Y-axis

Specify 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, enterVelocity (%<SignalUnits>).

Dependencies

If you select the Plot as magnitude-phase parameter under Display settings, this parameter does not apply. The _y_-axes are labeledMagnitude and Phase.

Programmatic Use

See YLabel.

Specify the _y_-axis limits as a two-element numeric vector.

Tunable: Yes

Dependencies

If you select Plot as magnitude-phase, this property only applies to the magnitude plot. The_y_-axis limits of the phase plot are always[-180 180].

Programmatic Use

See YLimits.

Note

All the Display properties affect only the active display that you select through the Active Display parameter.

Settings > Display

Specify the title for the display. The default value%<SignalLabel> uses the input signal name for the title.

Programmatic Use

See Title.

Select this parameter to display the signal legend. The names listed in the legend are the signal names from the model. For signals with multiple channels, the scope appends a channel index 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 Line 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.

Programmatic Use

See ShowLegend.

Select this parameter to show internal grid lines.

Programmatic Use

See ShowGrid.

Select this parameter to split the display into magnitude and phase plots.

Programmatic Use

See PlotAsMagnitudePhase.

Display Grid

Specify the layout of the displays. Opens a grid picker similar to the scope layout. The layout can have a maximum of 16 rows and 16 columns. Using the grid picker, you can select a layout of size up to 5-by-5. To select a layout of size greater than 5-by-5:

Animated GIF of changing the layout from one display to two displays

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. If the number of displays is greater than the number of ports, the scope creates empty tiles.

Programmatic Use

See LayoutDimensions.

Dock

Click Dock or Dock Scope in theScope tab to add the currently active scope to the scope container. Click Dock All Scopes to add all the opened scopes in the current model to the scope container.

For more information on the scope container, see Scope Window Management.

Click Undock in the Home tab of the scope container to remove the currently active scope from the container into a separate stand-alone window. Click Undock All to remove all scopes from the container into separate stand-alone windows.

For more information on the scope container, see Scope Window Management.

Dependencies

This parameter is available only on the Home tab of the scope container.

Select this parameter to add the newly opened scopes (which have not been opened before in the current session of MATLAB) automatically to the existing scope container.

For more information on the scope container, see Scope Window Management.

Dependencies

This parameter is available only on the Home tab of the scope container. To access this parameter, click the drop down arrow of Dock All under theHome tab of the scope container.

Measurements Tab

The Measurements tab contains the settings for all the signal measurements that the scope supports. The measurement panels appear at the bottom of the scope window. To open a measurement panel, you must first enable the corresponding measurement in the Measurements tab.

Measurements tab of the Scope block and the Time Scope block.

For more information on the measurements, see these pages:

Block Characteristics

Data Types Boolean | busa double enumerated fixed point half integer single
Direct Feedthrough no
Multidimensional Signals yes
Variable-Size Signals yes
Zero-Crossing Detection no
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.

More About

expand all

Dock multiple scopes of a Simulink model into a single window called the scope container. The scope container provides a convenient interface from which you can visualize the signals and manage the settings of the scopes. The settings in the Home tab and theMeasurements tab apply only to the active scope, that is, the scope in the container that you are actively interacting with.

Home Tab

The Home tab of the scope container has settings similar to theScope tab of the Scope block toolstrip.

Screenshot of Home tab

Settings

Click Settings to launch the Style Settings side panel for the currently active scope. In this panel, you can control all the scope related settings, such as general settings, time and axes settings, display settings, style settings, and settings related to logging. For more information on these properties, see Settings in the Scope reference page.

Display Grid

Opens a grid picker similar to the scope layout. The layout can have a maximum of 16 rows and 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. If the number of displays is greater than the number of ports, the scope creates empty tiles.

Dock All

Click Dock All to add all the opened scopes in the current model to the scope container. To automatically add newly opened scopes to the existing scope container, select Dock All > Dock New Scopes on Open.

Undock

Click Undock to remove the currently active scope from the container into a separate stand-alone window. When there are multiple scopes docked in the container, click Undock > Undock All to remove all scopes from the container into separate stand-alone windows.

Measurements Tab

The Measurements tab of the scope container has settings similar to the Measurements tab of the Scope block toolstrip.

Screenshot of Measurements tab

Extended Capabilities

expand all

This block can be used for simulation visibility in systems that generate code, but is not included in the generated code.

HDL Architecture

Architecture Description
No HDL Do not generate HDL code for this block.

HDL Block Properties

PreserveUpstreamLogic Control the removal of unconnected logic. The default is off, which means unconnected logic is not preserved in HDL code. For more details, see PreserveUpstreamLogic (HDL Coder).

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.

Version History

Introduced in R2015b

expand all

The SimulinkScope, Time Scope (DSP System Toolbox), and Floating Scope and Scope Viewer blocks in Simulink have a new user interface that you can use to access settings and measurements of the scope. The scope is now more responsive and its performance is improved. Use the new scope container to dock multiple scope windows into a single window and to manage and organize the scopes. The scope container also enables you to view all the scopes in the model in a single window.

Key improvements to the Scope, Time Scope, andFloating Scope and Scope Viewer blocks are:

The underlying graphics of the SimulinkScope block have changed. You cannot access or modify the SimulinkScope block through the MATLAB Graphics API.

To display the scope data in a MATLAB Graphics window, use the Print to Figure functionality in the Scope tab of the Scope block toolstrip.

The ability to dock the SimulinkScope, Time Scope (DSP System Toolbox), and Floating Scope and Scope Viewer to the MATLAB desktop has been removed. Use the new scope container instead. For more information, see Scope Window Management.

If you have a model created in R2024b or a previous release with four or more open scopes, and you open that model in R2025a, the opened scopes automatically dock in the scope container window.