Main Content

dsp.TimeScope

(To be removed) Time domain signal display and measurement

Description

Note

dsp.TimeScope is not recommended. Use timescope instead. For more information, see Version History

The dsp.TimeScope 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:

  1. Create the dsp.TimeScope object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

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.

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.

Creation

Description

scope = dsp.TimeScope returns a Time Scope System object, scope. This object displays real- and complex-valued floating and fixed-point signals in the time domain.

scope = dsp.TimeScope(numInputs,sampleRate) creates a Time Scope and sets the NumInputPorts property to numInputs and the SampleRate property to sampleRate.

scope = dsp.TimeScope(___,Name,Value) sets properties specified as Name,Value pairs.

example

Properties

expand all

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.

Frequently Used

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.

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.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

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(TimeDisplayOffset)

  • Maximum time-axis limit = max(TimeDisplayOffset) + TimeSpan

Tunable: Yes

Dependencies

To use this property, set FrameBasedProcessing to false, or set FrameBasedProcessing to true and TimeSpanSource to 'Property'.

Scope Window Use

Open the Configuration Properties. On the Time tab, set Time Span.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

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.

Tunable: Yes

Scope Window Use

Open the Configuration Properties. On the Time tab, set Time Span overrun action.

Data Types: char | string

Specify the source of the time span for frame-based input signals as:

  • 'Property' – The object derives the x-axis limits from the TimeDisplayOffset and TimeSpan properties.

  • '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 = min(TimeDisplayOffset)

    • Maximum time-axis limit = max(TimeDisplayOffset) + max(1/SampleRate.*FrameSize)

Tunable: Yes

Dependencies

To use this property, set FrameBasedProcessing to true.

Scope Window Use

Open the Configuration Properties. On the Time tab, set Time Span.

Data Types: char | string

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 simulation.

  • "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.

Scope Window Use

Select Tools > Axes Scaling.

Data Types: char | string

Advanced

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.

Tunable: Yes

Data Types: char | string

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.

Tunable: Yes

  • 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 true.

Tunable: Yes

Scope Window Use

Select Simulation > Reduce Updates to Improve Performance.

Specify the layout grid dimensions as a 2-element vector: [numberOfRows,numberOfColumns]. You can use up to 16 rows and 16 columns.

Example: scope.LayoutDimensions = [2,4]

Tunable: Yes

Scope Window Use

Select View > Layout.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Specify the type of plot to use.

  • Line — Line graph, similar to the line or plot function.

  • Stairs — Stair-step graph, similar to the stairs function. Stair-step graphs are useful for drawing time history graphs of digitally sampled data.

Tunable: Yes

Scope Window Use

Open the Style properties. Set Plot type.

Data Types: char | string

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.

Scope Window Use

Open the Data History Properties. Set Buffer length.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

  • true — Enable frame-based processing.

  • false — Enable sample-based processing.

Scope Window Use

Open the Configuration Properties. On the Main tab, set Input processing.

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.

Tunable: Yes

Scope Window Use

Open the Configuration Properties. On the Time tab, set Time units.

Data Types: char | string

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.

Tunable: Yes

Scope Window Use

Open the Configuration Properties. On the Time tab, set Time display offset.

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.

Tunable: Yes

Scope Window Use

Open the Configuration Properties. On the Time tab, set Time-axis labels.

Data Types: char | string

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 if the Title and YLabel properties are empty for every display. If you enter any value in any display for either of these properties, the axes are not maximized.

  • "On" — The axes appear maximized in all displays. Any values entered into the Title and YLabel properties are hidden.

  • "Off" — None of the axes appear maximized.

Tunable: Yes

Scope Window Use

Open the Configuration Properties. On the Main tab, set Maximize axes.

Data Types: char | string

Display

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.

Tunable: Yes

Scope Window Use

Open the Configuration Properties. On the Display tab, set Active Display.

Display title, specified as a character vector or a string scalar.

Tunable: Yes

Scope Window Use

Click the Scope tab on the spectrum analyzer toolstrip. In the Configuration section, click Settings, and enter Title.

Data Types: char | string

Flag to show the legend, specified as true or false. To show a legend with the input names, set this property to true.

Use the legend to control which signals are visible. 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.

Tunable: Yes

Dependencies

To enable this property, set the ViewType property to "Spectrum" or "Spectrum and spectrogram".

Scope Window Use

Click the Scope tab on the Spectrum Analyzer toolstrip. To see the legend, click Legend in the Configuration section.

To enable the Legend, select Spectrum in the Scope tab.

Data Types: logical

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 TimeAxisLabels property is All or Bottom.

Tunable: Yes

Dependency

To control which display's axis is labeled, use the ActiveDisplay property.

Scope Window Use

Open the Configuration Properties. On the Time tab, set Show time-axis label.

Channel names in the input data, specified as a cell array of character vectors or an array of strings. The names you specify in this property appear in the following locations:

  • Legend

  • Spectrum Analyzer Settings > Color and styling section

  • Measurements and Channel Measurements tabs

If you do not specify channel names, the spectrum analyzer names the channels as Channel 1, Channel 2, and so on.

Tunable: Yes

Dependency

To see the channel names, set ShowLegend to true.

Scope Window Use

Click the Scope tab on the spectrum analyzer toolstrip. To see the legend, click Legend in the Configuration section.

Data Types: char

Set this property to true to show grid lines on the plot.

Tunable: Yes

Scope Window Use

Open the Configuration Properties. On the Display tab, set Show grid.

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.

Tunable: Yes

Scope Window Use

Open the Configuration Properties. On the Display tab, select Plot signals as magnitude and phase.

Specify the y-axis limits as a two-element numeric vector, [ymin, ymax].

If PlotAsMagnitudePhase is false, the default is [-10,10]. If PlotAsMagnitudePhase is true, the default is [0,10].

Tunable: Yes

Dependencies

When PlotAsMagnitudePhase is true, this property specifies the y-axis limits of only the magnitude plot. The y-axis limits of the phase plot are always [-180,180].

Scope Window Use

Open the Configuration Properties. On the Display tab, set Y-limits (Minimum) and Y-limits (Maximum).

Specify the text for the scope to display to the left of the y-axis.

Tunable: Yes

Dependencies

This property applies only when PlotAsMagnitudePhase is false. When PlotAsMagnitudePhase is true, the two y-axis labels are read-only values. The y-axis labels are set to "Magnitude" and "Phase" for the magnitude plot and the phase plot, respectively.

Scope Window Use

Open the Configuration Properties. On the Display tab, set Y-Label.

Data Types: char | string

Usage

Description

scope(signal) displays the signal, signal, in the time scope display.

scope(signal,signal2,...,signalN) displays the signals signal, signal2,...,signalN in the time scope display when you set the NumInputPorts property to N. In this case, signal1, signal2,...,signalN can have different data types and dimensions.

Input Arguments

expand all

Specify one or more input signals to visualize in the dsp.TimeScope. Signals can have different data types and dimensions.

Example: scope(signal1,signal2)

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fi

Object Functions

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 obj, use this syntax:

release(obj)

expand all

showDisplay scope window
hideHide scope window
isVisibleDetermine visibility of scope
stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object

If you want to restart the simulation from the beginning, call reset to clear the scope window displays. Do not call reset after calling release.

Examples

collapse all

Create dsp.SineWave and dsp.TimeScope objects. 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

Run the release method to allow changes to property values and input characteristics. The scope automatically scales the axes.

release(scope)

Tips

  • To close the scope window and clear its associated data, use the MATLAB® clear function.

  • To hide or show the scope window, use the hide and show functions.

  • 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.

Extended Capabilities

Version History

Introduced in R2011a

collapse all

R2021a: dsp.TimeScope will be removed

dsp.TimeScope will be removed in a future release. Use timescope instead.