DSP Blockset    
Vector Scope

Display a vector or matrix of time-domain, frequency-domain, or user-defined data.

Library

DSP Sinks

Description

The Vector Scope block is a comprehensive display tool similar to a digital oscilloscope. The block can display time-domain, frequency-domain, or user-defined signals. You can use the Vector Scope block to plot consecutive time samples from a frame-based vector, or to plot vectors containing data such as filter coefficients or spectral magnitudes. To compute and plot the short-time fast Fourier transform (STFFT) of a signal with a single block, use the Spectrum Scope block.

The input to the Vector Scope can be any real-valued M-by-N matrix, column or row vector, or 1-D (unoriented) vector, where 1-D vectors are treated as column vectors. Regardless of the input frame status, the block treats each column of an M-by-N input as an independent channel of data with M consecutive samples.

The block plots each sample of each input channel sequentially across the horizontal axis of the plot

Sections of This Reference Page

Specifying the Input Domain

Specify the domain of the input data as Time, Frequency, or User-defined in the Input domain parameter under the Scope properties check box.

Input Domain Parameter Settings
  • Time

  • For M-by-N inputs containing time-domain data, the block treats each of the N input frames (columns) as a succession of M consecutive samples taken from a time-series. That is, each data point in the input frame is assumed to correspond to a unique time value.

  • Frequency

  • For M-by-N inputs containing frequency-domain data, the block treats each of the N input frames (columns) as a vector of spectral magnitude data corresponding to M consecutive ascending frequency indices. That is, if the input is a single column vector, u, each value in the input frame, u(i), is assumed to correspond to a unique frequency value, f(i), where f(i+1)>f(i).

  • User-defined

  • For inputs specified as user-defined data, the block does not make any assumptions about the nature of the data in the input frame. In particular, it does not assume that it is time-domain or frequency-domain data. Various block parameters give you complete freedom to plot the data in the most appropriate manner.

Changing the Display Span of the x-Axis

The scope displays frames of data, and updates the display for each new input frame. The number of sequential frames displayed on the scope is specified by the Time display span parameter for time-domain signals, and the Horizontal display span parameter for user-defined signals. Setting either parameter to 1 plots the current input frame's data across the entire width of the scope. Setting these display-span parameters to larger numbers allows you to see a broader section of the signal by fitting more frames of data into the display region. A single frame is the smallest unit that can be displayed, so neither parameter can be less than 1.

Vector Scope Display with Time Display Span = 4

Scaling the Horizontal Axis for Time-Domain Signals

Scaling of the horizontal (time) axis for time-domain signals is automatic. The range of the time axis is [0,S*Tfi], where Tfi is the input frame period, and S is the Time display span parameter. The spacing between time points is Tfi/(M-1).

Scaling the Horizontal Axis for User-Defined Signals

To correctly scale the horizontal axis for user-defined signals, the block needs to know the spacing of the data in the input. This is specified by the Increment per sample in input frame parameter, Is. This parameter represents the numerical interval between adjacent x-axis points corresponding to the input data. For example, an input signal sampled at 500 Hz has an increment per sample of 0.002 second. The actual units of this interval (seconds, meters, Volts, etc.) are not needed for axis scaling.

When the Inherit sample increment from input check box is selected, the block scales the horizontal axis by computing the horizontal interval between samples in the input frame from the frame period of the input. For example, if the input frame period is 1, and there are 64 samples per input frame, the interval between samples is computed to be 1/64. Computing the interval this way is usually only valid if the following conditions hold:

In other cases, the frame rate and frame size do not provide enough information for the block to correctly scale the horizontal axis, and you should specify the appropriate value for the Increment per sample in input frame parameter. The range of the horizontal axis is [0,M*Is*S], where M is the number of samples in each consecutive input frame, and S is the Horizontal display span parameter.

Scaling the Horizontal Axis for Frequency-Domain Signals

In order to correctly scale the horizontal (frequency) axis for frequency-domain signals, the Vector Scope block needs to know the sample period of the original time-domain sequence represented by the frequency-domain data. This is specified by the Sample time of original time series parameter.

When the Inherit sample time from input check box is selected, the block scales the frequency axis by reconstructing the frequency data from the frame-period of the frequency-domain input. This is valid when the following conditions hold:

In cases where not all of these conditions hold, you should specify the appropriate value for the Sample time of original time-series parameter.

The Frequency units parameter specifies whether the frequency axis values should be in units of Hertz or rad/sec, and the Frequency range parameter specifies the range of frequencies over which the magnitudes in the input should be plotted. The available options are [0..Fs/2], [-Fs/2..Fs/2], and [0..Fs], where Fs is the original time-domain signal's sample frequency.

The Vector Scope block assumes that the input data spans the range [0,Fs), as does the output from an FFT. To plot over the range [0..Fs/2] the scope truncates the input vector leaving only the first half of the data, then plots these remaining samples over half the frequency range. To plot over the range [-Fs/2..Fs/2], the scope reorders the input vector elements such that the last half of the data becomes the first half, and vice versa; then it relabels the x-axis accordingly.

If the Frequency units parameter specifies Hertz, the spacing between frequency points is 1/(M*Ts). For Frequency units of rad/sec, the spacing between frequency points is 2/(M*Ts). The Amplitude scaling parameter allows you to select Magnitude or dB scaling along the y-axis.

Scope Properties

The Vector Scope block allows you to plot time-domain, frequency-domain, or user-defined data, and adjust the frame span of the plot. Selecting the Scope Properties check box displays the Input domain parameter, which specifies the domain of the input data. In addition, for time-domain data, a Time display span parameter allows you to specify the number of frames to be displayed across the width of the scope window at any given time. For user-defined data, a Horizontal display span parameter serves the same function. Both of these parameters must be 1 or greater. See Specifying the Input Domain for more information.

Display Properties

The Vector Scope and Spectrum Scope blocks offer a similar collection of display property settings. These can be exposed in the parameter dialog box by selecting the Display properties check box. Many of the properties can be accessed under the Axes menu in the unzoomed scope view (when Compact display is cleared), or by right-clicking on the scope window.

The Show grid parameter toggles the background grid on and off. This option can also be set in the Axes menu of the scope window.

When Persistence is selected, the window maintains successive displays. That is, the scope does not erase the display after each frame (or collection of frames), but overlays successive input frames in the scope display. This option can also be set in the Axes menu of the scope window.

When Frame number is selected, the number of the current frame in the input sequence is displayed on the scope window, incrementing the count as each new input is received. Counting starts at 1 with the first input frame, and continues until the simulation stops.

When Channel legend is selected, a legend indicating the line color, style, and marker of each channel's data is added. If the input signal is labeled, that label is displayed in the channel legend. If the input signal is not labeled, but comes from a Matrix Concatenation block with labeled inputs, those labels are displayed in the channel legend. Otherwise, each channel in the legend is labeled with the channel number (CH 1, CH 2, etc.). Click and drag on the legend to reposition it in the scope window; double click on the line label to edit the text. Note that when the simulation is rerun, the new edits are lost and the labels revert to the defaults. The Channel legend option can also be set in the Axes menu of the scope window.

When Compact display is selected, the scope completely fills the containing figure window. Menus and axis titles are not displayed, and the numerical axis labels are shown within the axes. When Compact display is cleared, the axis labels and titles are displayed in a gray border surrounding the scope axes, and the window's menus (including Axes and Channels) and toolbar are visible. This option can also be set in the Axes menu of the scope window.

When Open scope at start of simulation is selected, the scope opens at the start of the simulation. When this parameter is cleared, the scope does not open automatically during the simulation. To view the scope, double-click on the Vector Scope block, which brings up the scope as well as the block parameter dialog box. This feature is useful when you have several scope blocks in a model, and you do not want to view all the associated scopes during the simulation.

Open scope immediately allows you to open the scope from the Vector Scope parameters dialog box while the simulation is running. If the simulation is running and the scope window is not visible, you can double-click on the scope block to expose the scope window and the parameters dialog box. If you close the scope window during simulation, you can make it visible again by checking the Open scope immediately check box as long as the simulation is running. The check box will become cleared as soon as the scope opens.

The Scope position parameter specifies a four-element vector of the form

specifying the position of the scope window on the screen, where (0,0) is the lower-left corner of the display. See the MATLAB figure command for more information.

Axis Properties

The Vector Scope and Spectrum Scope blocks also share a similar collection of axis property settings. For the Vector Scope, the parameters listed under the Axis properties check box vary with the domain of the input. The dialogue box below shows the parameters available for frequency-domain data.



Minimum Y-limit and Maximum Y-limit set the range of the vertical axis. If Autoscale is selected from the right-click pop-up menu or from the Axes menu option, the Minimum Y-limit and Maximum Y-limit values are automatically recalculated to best fit the range of the data on the scope. Both of these parameters are available for all input domains.

Y-axis title is the text to be displayed to the left of the y-axis. This parameter is available for all input domains. X-axis title is an analogous parameter available only when plotting user-defined data (this parameter is not visible in the dialog box shown).

Frequency-domain and user-defined data need extra information to scale the horizontal axis. For user-defined data, the parameters that provide this information are Inherit sample increment from input and Increment in sample in input frame. See Scaling the Horizontal Axis for User-Defined Signals for more information. For frequency-domain data, an analogous pair of parameters, Inherit sample time from input and Sample time of original time series, must be specified. See Scaling the Horizontal Axis for Frequency-Domain Signals for more information.

Three other parameters related to scaling the x-axis for frequency-domain signals are Frequency units, Frequency range, and Amplitude scaling. These are also described in Scaling the Horizontal Axis for Frequency-Domain Signals.

Line Properties

Both the Vector Scope and Spectrum scope also offer a similar collection of line property settings. These can be exposed in the parameter dialog box by selecting the Line properties check box. These properties can also be accessed under the Channels menu in the unzoomed scope view (when Compact display is cleared), or by right-clicking on the scope window.

The Line properties settings are typically used to help distinguish between two or more independent channels of data on the scope, as described in the following sections.

Line Visibilities.   The Line visibilities parameter specifies which channels' data is displayed on the scope, and which is hidden. The syntax specifies the visibilities in list form, where the term on or off as a list entry specifies the visibility of the corresponding channel's data. The list entries are separated by the pipe symbol, |.

A five-channel signal would ordinarily generate five distinct plots on the scope. To disable plotting of the third and fifth lines, enter the following visibility specification in the Line visibilities parameter.

Note that the first (leftmost) list item corresponds to the first signal channel (leftmost column of the input matrix).

Line Styles.   The Line styles parameter specifies the line style with which each channel's data is displayed on the scope. The syntax specifies the channel line styles in list form, with each list entry specifying a style for the corresponding channel's data. The list entries are separated by the pipe symbol, |.

For example, a five-channel signal would ordinarily generate all five plots with a solid line style. To plot each line with a different style, enter

These settings plot the signal channels with the following styles.

Line Style
Command to Type in Line Style Parameter
Appearance
Solid
-

Dashed
--

Dotted
:

Dash-dot
-.

No line
none
No line appears

Note that the first (leftmost) list item, '-', corresponds to the first signal channel (leftmost column of the input matrix). See LineStyle property of the line function in the MATLAB documentation for more information about the style syntax. To specify a marker for the individual sample points, use the Line markers parameter, described below.

Line Markers.   The Line markers parameter specifies the marker style with which each channel's samples are represented on the scope. The syntax specifies the channels' marker styles in list form, with each list entry specifying a marker for the corresponding channel's data. The list entries are separated by the pipe symbol, |.

For example, a five-channel signal would ordinarily generate all five plots with no marker symbol (i.e., the individual sample points are not marked on the scope). To instead plot each line with a different marker style, you could enter

These settings plot the signal channels with the following styles.

Marker Style
Command to Type in Marker Style Parameter
Appearance
Asterisk
*

Point
.

Cross
x

Square
s

Diamond
d

Note that the first (leftmost) list item, '*', corresponds to the first signal channel (leftmost column of the input matrix). See the Marker property of the line function in the MATLAB documentaion for more information about the available markers.

Type the word stem instead of one of the basic Marker shapes to produce a stem plot for the data in a particular channel.

Line Colors.   The Line colors parameter specifies the color in which each channel's data is displayed on the scope. The syntax specifies the channel colors in list form, with each list entry specifying a color (in one of the MATLAB ColorSpec formats) for the corresponding channel's data. The list entries are separated by the pipe symbol, |.

For example, a five-channel signal would ordinarily generate all five plots in the color black. To instead plot the lines with the color order below, enter

or

These settings plot the signal channels in the following colors (8-bit RGB equivalents shown in the center column).

Color
RGB Equivalent
Appearance
Black
(0,0,0)

Blue
(0,0,255)

Red
(255,0,0)

Green
(0,255,0)

Dark purple
(192,0,192)

Note that the first (leftmost) list item, 'k', corresponds to the first signal channel (leftmost column of the input matrix). See ColorSpec in the online MATLAB documentaion for more information about the color syntax.

Scope Window

The scope title (in the window title bar) is the same as the block title. The axis scaling is set by parameters listed under the Axis properties check box in the dialog box.

In addition to the standard MATLAB figure window menus (File, Edit, Window, Help), the Vector Scope window has an Axes and a Channels menu.

The properties listed in the Axes menu apply to all channels. Many of the parameters in this menu are also accessible through the block parameter dialog box. These are Persistence, Show grid, Compact display, Frame number, and Channel legend; see Display Properties for more information. Below are descriptions of the other parameters listed in the Axes menu:

The properties listed in the Channels menu apply to a particular channel. The parameters listed in this menu are Visible, Style, Marker, and Color; they correspond to the parameters listed in the dialog box under the Line properties check box. See Line Properties for more information.

Many of these options can also be accessed by right-clicking with the mouse anywhere on the scope display. The menu that pops up contains a combination of the options available in both the Axes and Channels menus. The right-click menu is very helpful when the scope is in zoomed mode, when the Axes and Channels menus are not visible.

Dialog Box

Scope Properties Dialog Box

Scope properties
Select to expose Scope properties panel. See Scope Properties. Tunable.
Input domain
The domain of the input; Time, Frequency, or User-defined. See Specifying the Input Domain. Tunable.
Time display span
The number of consecutive frames to display (horizontally) on the scope at any one time. (Visible when the Input domain parameter is Time.) See Changing the Display Span of the x-Axis.
Horizontal display span
(Not visible in the dialog box shown; appears under Scope properties when the Input domain parameter is User-defined.) The number of consecutive frames to display (horizontally) on the scope at any one time. See Changing the Display Span of the x-Axis.

Display Properties Dialog Box

Display properties
Select to expose Display properties panel. See Display Properties. Tunable.
Show grid
Toggles the scope grid on and off. See Display Properties. Tunable.
Persistence
Causes the window to maintain successive displays. That is, the scope does not erase the display after each frame (or collection of frames), but overlays successive input frames in the scope display. See Display Properties. Tunable.
Frame number
Displays the number of the current frame in the input sequence, when selected with Compact display off. The frame number is not shown when Compact display is selected. See Display Properties. Tunable.
Channel legend
Toggles the legend on and off. See Display Properties. Tunable.
Compact display
Resizes the scope to fill the window. See Display Properties. Tunable.
Open scope at start of simulation
Opens the scope at the start of the simulation. When this parameter is cleared, the scope will not open automatically during the simulation; to view the scope, double click on the Vector Scope block during the simulation. This will bring up the scope as well as the block parameter dialog box. See Display Properties. Tunable.
Open scope immediately
Opens the scope from the Vector Scope parameters dialog box while the simulation is running. The check box becomes cleared automatically after use. See Display Properties. Tunable.
Scope position
A four-element vector of the form [left bottom width height] specifying the position of the scope window. (0,0) is the lower-left corner of the display. See Display Properties. Tunable.

Axis properties Dialog Box

Axis properties
Select to expose the Axis Properties panel. See Axis Properties. Tunable.
Frequency units
The frequency units for the x-axis, Hertz or rad/sec. (Visible when the Input domain parameter is Frequency.) See Axis Properties. Tunable.
Frequency range
The frequency range over which to plot the data, [0..Fs/2], [-Fs/2..Fs/2], or [0..Fs], where Fs is the sample frequency of the original time-domain signal, 1/Ts. (Visible when the Input domain parameter is Frequency.) See Axis Properties. Tunable.
Inherit sample time from input
Computes the time-domain sample period from the frame period and frame size of the frequency-domain input; use only if the length of the each frame of frequency-domain data is the same as the length of the frame of time-domain data from which is was generated. (Visible when the Input domain parameter is Frequency.) See Axis Properties. Tunable.
Sample time of original time series
The sample period of the original time-domain signal, Ts. (Visible when the Input domain parameter is Frequency.) See Axis Properties. Tunable.
Inherit sample increment from input
(Not visible in the dialog box shown; appears under Axis properties when the Input domain parameter is User-defined.) Scales the horizontal axis by computing the horizontal interval between samples in the input frame from the frame period of the input; use only if the input's sample period is equal to the period with which the physical signal was originally sampled. See Axis Properties. Tunable.
Increment per sample in input frame
(Not visible in the dialog box shown; appears under Axis properties when the Input domain parameter is User-defined.) The numerical interval between adjacent x-axis points corresponding to the user-defined input data. See Axis Properties. Tunable.
Amplitude scaling
The scaling for the y-axis, dB or Magnitude. (Visible when the Input domain parameter is Frequency.) See Axis Properties. Tunable.
Minimum Y-limit
The minimum value of the y-axis. Tunable.
Maximum Y-limit
The maximum value of the y-axis. Tunable.
Y-Axis title
The text to be displayed to the left of the y-axis. Tunable.
X-Axis title
(Not visible in the dialog box shown; appears under Axis properties when the Input domain parameter is User-defined.) The text to be displayed below the x-axis. Tunable.

Line Properties Dialog Box

Line properties
Select to expose the Line Properties panel. See Line Properties. Tunable.
Line visibilities
The visibility of the various channels' scope traces, on or off. Channels are separated by a pipe (|) symbol. See Line Properties. Tunable.
Line styles
The line styles of the various channels' scope traces. Channels are separated by a pipe (|) symbol. See Line Properties. Tunable.
Line markers
The line markers of the various channels' scope traces. Channels are separated by a pipe (|) symbol. See Line Properties. Tunable.
Line colors
The colors of the various channels' scope traces, in one of the ColorSpec formats. Channels are separated by a pipe (|) symbol. See Line Properties. Tunable.

Supported Data Types

To learn how to convert to the above data types in MATLAB and Simulink, see Supported Data Types and How to Convert to Them.

See Also

Matrix Viewer
DSP Blockset
Spectrum Scope
DSP Blockset

Also see the following topics:


  Variance Window Function