Floating Scope and Scope Viewer
Display signals generated during simulation without signal lines
Libraries:
Simulink /
Sinks
HDL Coder /
Sinks
Description
The Simulink® Scope Viewer and Floating Scope block display time domain signals with respect to simulation time. The Scope Viewer and Floating Scope block have the same functionality as the Scope block, but they are not connected to signal lines.
For information on controlling a Floating Scope block from the command line, see Control Scope Blocks Programmatically in the Simulink documentation.
Connect Signals
In the Floating Scope window or Scope viewer window, use the button to connect signals.
To add a viewer with a connected signal, select a signal in the model. Then, on the Simulation tab, in the Prepare gallery, click Add Viewer.
For more details, see Add Signals to an Existing Floating Scope or Scope Viewer.
Key Features
Multiple y-axes (displays) — Display multiple y-axes with multiple input ports. All the y-axes have a common time range on the x-axis.
Multiple signals — Show multiple signals on the same y-axis (display) from one or more input ports.
Modify parameters — Modify scope parameter values before and during a simulation.
Display data after simulation — If a scope is closed at the start of a simulation, scope data is still written to the scope during the simulation. If you open the scope after a simulation, the scope displays simulation results for input signals.
Oscilloscope Measurements
Triggers — Set triggers on repeating signals and pause the display when events occur.
Cursor Measurements — Measure signal values using vertical and horizontal cursors.
Signal Statistics1 — Display the maximum, minimum, peak-to-peak difference, mean, median, and RMS values of a selected signal.
Peak Findera — Find maxima, showing the x-axis values at which they occur.
Bilevel Measurementsa — Measure transitions, overshoots, undershoots, and cycles.
Examples
Simulation of Bouncing Ball
Uses two models of a bouncing ball to show different approaches to modeling hybrid dynamic systems with Zeno behavior. Zeno behavior is informally characterized by an infinite number of events occurring in a finite time interval for certain hybrid systems. As the ball loses energy, the ball collides with the ground in successively smaller intervals of time.
Limitations
When you use model configuration parameters that optimize the simulation, such as Signal storage reuse or Block reduction, Simulink eliminates storage for some signals during simulation. You are unable to apply a Floating Scope to these eliminated signals. To work around this issue, configure an eliminated signal as a test point. You can then apply a Floating Scope to the signal regardless of optimization settings. To configure test points, see Configure Signals as Test Points.
If you step back the simulation after adding or removing a signal, the Floating Scope clears the existing data. New data does not appear until the simulation steps forward again.
When connected to a constant signal, the scope plots a single point.
Simulink messages are not supported for Floating Scope block and Scope Viewer.
You cannot connect signals from for-each subsystems.
Scope displays have limitations in Rapid Accelerator mode. See Behavior of Scopes and Viewers with Rapid Accelerator Mode
Ports
Input
Port_1 — Signal or signals to visualize
scalar | vector | matrix | array | bus | nonvirtual bus
Connect 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.
This block accepts fixed-point input, but converts it to
double
for display.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.
Input Limitations
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.
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
Properties
Configuration Properties
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 opens
off (default) | on
Select this check box to open the scope window when simulation starts.
Programmatic Use
Display the full path — Display block path on scope title bar
off (default) | on
Select this check box to display the block path in addition to the block name.
Layout — Number and arrangement of displays
1-by-1 display (default) | an arrangement of m-by-n displays
Specify number and arrangement of displays. To expand the layout grid beyond 4 by 4, click within the dialog box and drag. The maximum layout is 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 and then across.
Programmatic Use
See LayoutDimensions
.
Input processing — Channel or element signal processing
Elements as channels (sample based)
(default) | Columns as channels (frame based)
Elements as channels (sample based)
— Process each element as a unique sample.Columns as channels (frame based)
— Process signal values in a column as a group of values from multiple time intervals. Frame-based processing is available only with discrete input signals.
Programmatic Use
See FrameBasedProcessing
.
Maximize axes — Maximize size of plots
Off
(default) | Auto
| On
Time span — Length of x-axis to display
Auto
(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 to20
, the scope sets the time range from10
to30
.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 toColumns as channels (frame based)
.
Programmatic Use
See TimeSpan
.
Time span overrun action — Display data beyond visible x-axis
Wrap
(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.
Programmatic Use
Time display offset — x-axis offset
0
(default) | scalar | vector
Offset 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.
Programmatic Use
See TimeDisplayOffset
.
Time-axis labels — Display of x-axis labels
Bottom 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. SelectingNone
also clears the Show time-axis label check box.Bottom displays only
— Display x-axis label on the bottom y-axis.
Dependencies
To enable this property, set:
Show time-axis label to on.
Maximize axes to off.
The Active display property determines which display is affected.
Programmatic Use
See TimeAxisLabels
.
Show time-axis label — Display or hide x-axis labels
off (default for Scope) | on (default for Time Scope)
Select this check box to show the x-axis label for the active display
Dependencies
To enable this property, set Time-axis labels
to All
or Bottom Displays
Only
.
The Active display property determines which display is affected.
Programmatic Use
See ShowTimeAxisLabel
.
Active display — Selected display
1
(default) | positive integer
Selected 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.
Programmatic Use
See ActiveDisplay
.
Title — Display name
%<SignalLabel>
(default) | string
Title for a display. The default value %<SignalLabel>
uses the input signal name for
the title.
Dependency
The Active display property determines which display is affected.
Programmatic Use
See Title
.
Show legend — Display signal legend
off (default) | on
Toggle 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.
Dependency
The Active display property determines which display is affected.
Programmatic Use
See ShowLegend
.
Show grid — Show internal grid lines
on (default) | off
Select this check box to show grid lines.
Dependency
The Active display property determines which display is affected.
Programmatic Use
See ShowGrid
.
Plot signals as magnitude and phase — Split display into magnitude and phase plots
off (default) | on
On — 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.
Dependency
The Active display property determines which display is affected.
Programmatic Use
See PlotAsMagnitudePhase
.
Y-limits (Minimum) — Minimum y-axis value
-10
(default) | real scalar
Specify the minimum value of the y-axis as a real number.
Tunable: Yes
Dependency
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.
Programmatic Use
See YLimits
.
Y-limits (Maximum) — Maximum y-axis value
10
(default) | real scalar
Specify the maximum value of the y-axis as a real number.
Tunable: Yes
Dependency
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.
Programmatic Use
See YLimits
.
Y-label — Y-axis label
none (default for Scope) | Amplitude
(default for Time Scope) | string
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
, enter Velocity
(%<SignalUnits>)
.
Dependency
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.
Programmatic Use
See YLabel
.
Limit data points to last, Limit frames to last — Limit buffered data points or frames
off
,
5000
(default) | on
| positive integer
Select this property to limit data saved by the scope internally. When you select this property and set the Input processing parameter to:
Elements as channels (sample based)
–– The scope saves the last n data points and the name of this property is Limit data points to last. n is the scalar value you specify in this property text box.Columns as channels (frame based)
–– The scope saves the last n data frames and the name of this property is Limit frames to last.
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.
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 to
inf
, 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
Decimation, Decimate frames — Reduce amount of scope data to display and save
off
, 2
(default) | on
| positive integer
Select this property to plot and log (save) scope data every
Nth data point or frame, where
N is the decimation factor you specify in this
property text box. A value of 1
buffers all the data
values.
When you set the Input processing parameter to:
Elements as channels (sample based)
–– The scope plots and logs data every Nth data point. The name of this property is Decimation.Columns as channels (frame based)
––- The scope plots and logs data every Nth frame. The name of this property is Decimate frames.
When you clear this property, the scope saves all the scope data.
Programmatic Use
Log/Unlog Viewed Signals to Workspace — Toggle logging
on | off
For signals selected with the Signal Selector, clicking this button toggles the state of the Log signal data check boxes in the Signals Properties dialog boxes.
Axes Scaling Properties
The Axes Scaling Properties 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 mode
Manual
(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 check box. If you want the y-axis range to increase and decrease with the maximum value of a signal, set Axes scaling toAuto
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 text box (10
by default). Scaling occurs only once during each run.
Programmatic Use
See AxesScaling
.
Do not allow Y-axis limits to shrink — When y-axis limits can change
on (default) | off
Allow y-axis range limits to increase but not decrease during a simulation.
Dependency
To use this property, set Axes scaling to
Auto
.
Number of updates — Number of updates before scaling
10
(default) | integer
Set this property to delay auto scaling the y-axis.
Dependency
To use this property, set Axes scaling to
After N Updates
.
Programmatic Use
Scale axes limits at stop — When y-axis limits can change
on (default) | off
On — Scale axes when simulation stops.
Off — Scale axes continually.
Dependency
To use this property, set Axes scaling to
Auto
.
Y-axis Data range (%) — Percent of y-axis to use for plotting
80
(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-axis
Center
(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 limits
off (default) | on
Scale 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 plotting
100
(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-axis
Center
(default) | Left
| Right
Specify where to align plotted data along the x-axis data range when X-axis Data range is set to less than 100 percent.
Right
— Align signals with the maximum values of the x-axis range.Center
— Center signals between the minimum and maximum values.Left
— Align signals with the minimum values of the x-axis range.
Style Properties
To open the Style dialog box, from the scope menu, select View > Style.
Figure color — Background color for window
black (default) | color
Background color for the scope.
Plot type — How to plot signal
Auto
(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 displays
black (default) | color
Select 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 colors
off (default) | on
Specify 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 change
Channel 1
(default)
Select active line for setting line style properties.
Visible — Line visibility
on (default) | off
Show or hide a signal on the plot.
Dependency
The values of Active display and Properties for line determine which line is affected.
Line — Line style
solid line (default style) | 0.75 (default width) | yellow (default color)
Select line style, width, and color.
Dependency
The values of Active display and Properties for line determine which line is affected.
Marker — Data point marker style
None
(default) | marker shape
Select marker shape.
Dependency
The values of Active display and Properties for line determine which line is affected.
Block Characteristics
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
This block can be used for simulation visibility in systems that generate code, but is not included in the generated code.
HDL Code Generation
Generate VHDL, Verilog and SystemVerilog code for FPGA and ASIC designs using HDL Coder™.
This block can be used for simulation visibility in subsystems that generate HDL code, but is not included in the hardware implementation.
PLC Code Generation
Generate Structured Text code using Simulink® PLC Coder™.
This block can be used for simulation visibility in systems that generate code, but is not included in the generated code.
Fixed-Point Conversion
Design and simulate fixed-point systems using Fixed-Point Designer™.
This block accepts fixed-point input, but converts it to double for display.
Version History
Introduced in R2015b
See Also
Blocks
1 You must have a Simscape™ or DSP System Toolbox™ license to use the Peak Finder, Bilevel Measurements, and Signal Statistics.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)