(To be removed) Time domain signal display and measurement
System object™ displays time-domain signals. You can use the scope to measure signal values,
find peaks, display bilevel measurements and statistics.
To see time-domain signals in the scope:
dsp.TimeScope object and set its properties.
Call the object with arguments, as if it were a function.
To learn more about how System objects work, see What Are System Objects?.
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.
For information on measurements and triggers, see Configure Time Scope Block.
Scope display features:
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 — Autoscaling during or at the end of a simulation. Margins are drawn at the top and bottom of the axes.
returns a Time Scope
scope = dsp.TimeScope
scope. This object displays real- and complex-valued
floating and fixed-point signals in the time domain.
sets properties specified as Name,Value pairs.
scope = dsp.TimeScope(___,Name,Value)
Unless otherwise indicated, properties are nontunable, which means you cannot change their
values after calling the object. Objects lock when you call them, and the
release function unlocks them.
If a property is tunable, you can change its value at any time.
For more information on changing property values, see System Design in MATLAB Using System Objects.
NumInputPorts— Number of input ports
1(default) | integer between [1, 96]
Number of input ports, specified as a positive integer. Each signal coming through a separate input becomes a separate channel in the scope. You must invoke the scope with the same number of inputs as the value of this property.
SampleRate— Sample rate of inputs
1(default) | scalar | vector
Specify the sample rate, in hertz, of the input signals.
You can specify a scalar or a numeric vector with length equal to the value of
NumInputPorts. The inverse of the sample rate determines the
spacing between points on the time axis in the displayed signal. When you set
SampleRate to a scalar value and
NumInputPorts is greater than 1, the object uses the same
sample rate for all inputs.
TimeSpan— Time span
10(default) | positive scalar
Specify the time span, in seconds, as a positive, numeric scalar value. The time-axis limits are calculated as follows.
Minimum time-axis limit = min(
Maximum time-axis limit = max(
Open the Configuration Properties. On the Time tab, set Time Span.
TimeSpanOverrunAction— Wrap or scroll when
Specify how the scope displays new data beyond the visible time span.
Wrap — In this mode, the scope displays
new data until the data reaches the maximum time-axis limit. When the data
reaches the maximum time-axis limit of the scope window, the scope clears the
display. The scope then updates the time offset value and begins displaying
subsequent data points starting from the minimum time-axis limit.
Scroll — In this mode, the scope scrolls
old data to the left to make room for new data on the right side of the scope
display. This mode is graphically intensive and can affect run-time performance.
However, it is beneficial for debugging and monitoring time-varying signals.
Open the Configuration Properties. On the Time tab, set Time Span overrun action.
TimeSpanSource— Source of time span
Specify the source of the time span for frame-based input signals as:
'Auto' – The time-axis limits are derived from the
TimeDisplayOffset and SampleRate properties and the FrameSize (number
of rows in each input signal). The limits are calculated as:
Minimum time-axis limit =
Maximum time-axis limit =
To use this property, set
Open the Configuration Properties. On the Time tab, set Time Span.
AxesScaling— Axes scaling mode
Specify when the scope scales the axes. Valid values are:
"Auto" — The scope scales the axes
as needed to fit the data, both during and after
"Manual" — The scope does not scale
the axes automatically.
"OnceAtStop" — The scope scales the
axes when the simulation stops.
"Updates" — The scope scales the
axes once and only once after 10 updates.
Select Tools > Axes Scaling.
Name— Window name
'Time Scope'(default) | character vector | string scalar
Specify the name of the scope as a character vector or string scalar. This name appears as the title of the scope's figure window. To specify a title of a scope plot, use the Title property.
Position— Window position
[left bottom width height]
Scope window position in pixels, specified by the size and location of the scope
window as a 4-element vector of the form
[left bottom width
height]. You can place the scope window in a specific position on your
screen by modifying the values to this property.
By default, the window appears in the center of your screen with a width of
410 pixels and height of
300 pixels. The exact
position value depends on your screen resolution.
ReduceUpdates— Reduce updates to improve performance
true — The scope logs data for later use and updates the window periodically.
false — The scope updates every time the scope is called.
The simulation speed is faster when this property is set to
Select Simulation > Reduce Updates to Improve Performance.
LayoutDimensions— Display layout grid dimensions
Specify the layout grid dimensions as a 2-element vector:
[numberOfRows,numberOfColumns]. You can use up to 16 rows and 16
scope.LayoutDimensions = [2,4]
Select View > Layout.
PlotType— Control the type of plot
Specify the type of plot to use.
Open the Style properties. Set Plot type.
BufferLength— Length of buffer used for each input signal
5000(default) | scalar
Specify the size of the buffer that the scope holds in its memory cache. Memory is limited by available memory on your system. If your signal has M rows of data and N data points in each row, M x N is the number of data points per time step. Multiply this result by the number of time steps for your model to obtain the required buffer length. For example, if you have 10 rows of data with each row having 100 data points and your run will be 10 time steps, you should enter 10,000 (10 x 100 x 10) as the buffer length.
Open the Data History Properties. Set Buffer length.
FrameBasedProcessing— Process input in frames
true — Enable frame-based processing.
false — Enable sample-based processing.
Open the Configuration Properties. On the Main tab, set Input processing.
TimeUnits— Units of time axis
Specify the units used to describe the time axis. You can select one of the following options:
Metric — In this mode, the scope converts the
times on the time axis to the most appropriate measurement units. These units
include milliseconds, microseconds, nanoseconds, minutes, days, etc. The scope
chooses the appropriate measurement units based on the minimum time-axis limit
and the maximum time-axis limit of the scope window.
Seconds — In this mode, the scope always displays
the units on the time axis as seconds.
None — In this mode, the scope does not display
any units on the time axis. The scope only shows the word
Time on the time axis.
Open the Configuration Properties. On the Time tab, set Time units.
TimeDisplayOffset— Offset x-axis limits
Specify, in seconds, how far to move the data on x-axis. The signal value does not change, only the displayed x-axis.
If you specify this property as a scalar, then that value is the time display offset for all channels.
If you specify a vector, each vector element is the time offset for the corresponding channel. For vectors with length less than the number of input channels, the time display offsets for the remaining channels are set to 0. If a vector has a length greater than the number of input channels, the extra vector elements are ignored.
Open the Configuration Properties. On the Time tab, set Time display offset.
TimeAxisLabels— Time-axis labels
Specify how time-axis labels should appear in the scope displays as:
'All' — Time-axis labels appear in all displays.
'Bottom' — Time-axis labels appear in the bottom
display of each column.
'None' — No labels appear in any display.
Open the Configuration Properties. On the Time tab, set Time-axis labels.
MaximizeAxes— Maximize axes control
Specify whether to display the scope in maximized-axes mode. In this mode, the axes are expanded to fit into the entire display. To conserve space, labels do not appear in each display. Instead, tick-mark values appear on top of the plotted data. You can select one of the following options:
"Auto" — The axes appear maximized in all displays only
YLabel properties are empty for every display. If you enter
any value in any display for either of these properties, the axes are not
"On" — The axes appear maximized in all displays. Any values entered into the
YLabel properties are hidden.
"Off" — None of the axes appear maximized.
Open the Configuration Properties. On the Main tab, set Maximize axes.
ActiveDisplay— Active display for setting properties
1(default) | integer
Specify the active display, by integer display number, to get and set relevant properties. The number of a display corresponds to its column-wise placement index. Set this property to control which display has its axes colors, line properties, marker properties, and visibility changed.
Open the Configuration Properties. On the Display tab, set Active Display.
Title— Display title
''(default) | character vector | string scalar
Specify the display title as a character vector or string.
Open the Configuration Properties. Set Title.
ShowLegend— Show legend
To show a legend with the input names, set this property to
From the legend, you can control which signals are visible. This control is equivalent to changing the visibility in the Style dialog box. 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. To show all signals, press Esc.
The legend only shows the first 20 signals. Any additional signals cannot be viewed or controlled from the legend.
Open the Configuration Properties. On the Display tab, select Show legend.
ShowTimeAxisLabel— Show legend on display
When you set this property to
true, the scope displays the
time-axis label. When you set this property to
false, the scope
does not display the time-axis label, but still displays tick marks and other
time-axis items. This property applies only if the
To control which display's axis is labeled, use the
Open the Configuration Properties. On the Time tab, set Show time-axis label.
ChannelNames— Channel names
Specify the input channel names as a cell array of character vectors. The names appear in the legend,
Style dialog box, and Measurements panels. If you do not specify names, the
channels are labeled as
Channel 2, etc.
To see channel names, set
On the legend, double-click the channel name.
ShowGrid— Grid visibility
Set this property to
true to show gridlines on the plot.
Open the Configuration Properties. On the Display tab, set Show grid.
PlotAsMagnitudePhase— Plot signal as magnitude and phase
When you set this property to
true, the scope plots the magnitude and phase of the input
signal on two separate axes within the same active display. When you set this property to
false, the scope plots the real and imaginary parts of the input signal on two separate
axes within the same active display.
This property is useful for complex-valued input signals. Turning on this property affects the phase for real-valued input signals. When the amplitude of the input signal is nonnegative, the phase is 0 degrees. When the amplitude of the input signal is negative, the phase is 180 degrees.
Open the Configuration Properties. On the Display tab, select Plot signals as magnitude and phase.
YLimits— y-axis limits
Specify the y-axis limits as a two-element numeric vector,
false, the default is
true, the default is
true, this property specifies the
y-axis limits of only the magnitude plot. The y-axis limits of the phase
plot are always
Open the Configuration Properties. On the Display tab, set Y-limits (Minimum) and Y-limits (Maximum).
YLabel— y-axis label
"Amplitude"(default) | character vector | string scalar
Specify the text for the scope to display to the left of the y-axis.
This property applies only when
true, the two y-axis labels are
read-only values. The y-axis labels are set to
"Phase" for the magnitude plot and the phase plot, respectively.
Open the Configuration Properties. On the Display tab, set Y-Label.
displays the signal,
signal, in the time scope display.
displays the signals
signalN in the time scope display
when you set the
NumInputPorts property to
signalN can have different data
types and dimensions.
signal— Input signal or signals to visualize
Specify one or more input signals to visualize in the
dsp.TimeScope. Signals can have different data types and
To use an object function, specify the
System object as the first input argument. For
example, to release system resources of a System object named
If you want to restart the simulation from the beginning, call
clear the scope window displays. Do not call
reset after calling
Run the scope to display the signal
sine = dsp.SineWave('Frequency',100,'SampleRate',1000); sine.SamplesPerFrame = 10; scope = dsp.TimeScope('SampleRate',sine.SampleRate,'TimeSpan',0.1); for ii = 1:10 x = sine(); scope(x); end
release method to allow changes to property values and
input characteristics. The scope automatically scales the axes.
To close the scope window and clear its associated data, use the MATLAB®
Use the MATLAB
mcc function to compile code containing a scope.
You cannot open scope configuration dialogs if you have more than one compiled component in your application.
Usage notes and limitations:
Supports MEX code generation by treating the calls to the object as extrinsic. Does not support code generation for standalone applications.
See System Objects in MATLAB Code Generation (MATLAB Coder).