| 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 block 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
Select the Show scope properties check box to display the Input domain parameter. Specify the domain of the input data as Time, Frequency, or User-defined.
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 (number of frames) parameter for time-domain signals, and the Horizontal display span (number of frames) parameter for user-defined signals. Setting either of these parameters 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 (Number of Frames) = 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 (number of frames) parameter. The spacing between time points is Tfi/(M-1), where M is the number of samples in each consecutive input frame.
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 (number of frames) 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 is set to Hertz, the spacing between frequency points is 1/(M*Ts), where Ts is the sample time of the original time-domain signal. If the Frequency units parameter is set to 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, the Time display span (number of frames) 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, the Horizontal display span (number of frames) 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 similar display property settings. You can view them by selecting the Show display properties check box.

The Show grid parameter toggles the background grid on and off.
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.
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 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.
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 function for more information.
Axis Properties
The Vector Scope and Spectrum Scope blocks also share similar axis property settings. For the Vector Scope block, the parameters listed under the Show axis properties check box vary with the domain of the input. The dialog 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 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 per sample in input frame. See Scaling the Horizontal Axis for User-Defined Signals for more information. For frequency-domain data, you must specify an analogous pair of parameters, Inherit sample time from input and Sample time of original time series. 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 described in Scaling the Horizontal Axis for Frequency-Domain Signals.
Line Properties
Both the Vector Scope and Spectrum Scope blocks also offer similar line property settings. You can view them by selecting the Show line properties check box.

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 channel's 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 the LineStyle property of the MATLAB line function 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 (that is, 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 leftmost list item, '*', corresponds to the first signal channel or leftmost column of the input matrix. See the Marker property of the MATLAB line function for more information about the available markers.
To produce a stem plot for the data in a particular channel, type the word stem instead of one of the basic marker shapes.
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 leftmost list item, 'k', corresponds to the first signal channel or leftmost column of the input matrix. See ColorSpec in the MATLAB documentation for more information about the color syntax.
Scope Window
The scope title in the window title bar is the same as the block title. In addition to the standard MATLAB figure window menus such as File, Window, and Help, the Vector Scope window contains Axes and Channels menus.
The parameters that you set using the Axes menu apply to all channels. Many of the parameters in this menu are also accessible through the Block Parameters dialog box. For descriptions of these parameters, see Display Properties. Below are descriptions of other parameters in the Axes menu:
The properties listed in the Channels menu apply to a particular channel. All of the parameters in this menu are also accessible through the Block Parameters dialog box. For descriptions of these parameters, see Line Properties.
Many of these options can also be accessed by right-clicking with the mouse anywhere on the scope display. The menu that is displayed 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 Pane

Time, Frequency, or User-defined. See Specifying the Input Domain. Tunable.
Time.
User-defined.
Display Properties Pane

[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 Pane

Hertz or rad/sec. See Axis Properties. Tunable.
Frequency.
[0..Fs/2], [-Fs/2..Fs/2], or [0..Fs], where Fs is the sample frequency of the original time-domain signal, 1/Ts. See Axis Properties. Tunable.
Frequency.
Frequency.
Frequency. Then, select the Show axis properties check box and clear the Inherit sample time from input check box.
dB or Magnitude. See Axis Properties. Tunable.
Frequency.
User-defined.
User-defined. Then, select the Show axis properties check box and clear the Inherit sample increment from input check box.
User-defined.
Line Properties Pane

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 your data types 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 Viewing Signals for how to use this and other blocks to view signals.
| Variance | Window Function | ![]() |
Learn more about the latest releases of MathWorks products: |
| © 1994-2009 The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |