DSP Blockset | ![]() ![]() |
Display a vector or matrix of time-domain, frequency-domain, or user-defined data.
Library
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.
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
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.
Scope Properties Dialog Box
Display Properties Dialog Box
[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
Line Properties Dialog Box
on
or off
. Channels are separated by a pipe (|) symbol. See Line Properties. Tunable.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 | ![]() |