# Vector Scope

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

## Library

Sinks

`dspsnks4`

## Description

 Note:   Consider using the Array Plot block, which offers more features than the Vector Scope. Additional features supported by the Array Plot are:Multiple inputsCursors, Signal Statistics, and Peak Finder measurementsMagnitude-phase plotLog x-axis scalingAdvanced panning, zooming, and autoscalingAbility to customize the plot appearance, such as, figure and axes colors, line width, and legend text

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 vector, or to plot vectors containing data such as filter coefficients or spectral magnitudes. To compute and plot the periodogram of a signal with a single block, use the Spectrum Analyzer block.

The input to the Vector Scope block can be any real-valued matrix or vector. The block treats each column of an M-by-N matrix 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.

### Scope Properties Pane

The Scope Properties pane enables you to plot time-domain, frequency-domain, or user-defined data, and adjust the horizontal display span of the plot. The scope displays frames of data, and updates the display for each new input frame.

The Input domain parameter specifies the domain of the input data. If you select `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. Also, the Time display span (number of frames) parameter appears on the pane. Enter a scalar value greater than or equal to one that corresponds to the number of frames to be displayed across the width of the scope window.

If you select `Frequency` for the Input domain parameter, 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, when 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)`.

If you select `User-defined` for the Input domain parameter, the block does not assume that the input frame data is time-domain or frequency-domain data. You can plot the data in the appropriate manner. Also, the Horizontal display span (number of frames) parameter appears on the pane. Enter a scalar value greater than or equal to one that corresponds to the number of frames to be displayed across the width of the scope window.

### Display Properties Pane

The Display Properties pane enables you to control how the block displays your data.

The Show grid parameter toggles the background grid on and off.

If you select the Frame number check box, the block displays the number of the current frame in the input sequence on the scope window, and the block increments the count as each new input is received. Counting starts at 1 with the first input frame, and continues until the simulation stops.

If you select the Channel legend check box, a legend indicating the line color, style, and marker of each channel's data is added. When the input signal is labeled, that label appears in the channel legend. When the input signal is not labeled, but comes from a Concatenate block or a Mux block with labeled inputs, those labels appear 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. If you rerun the simulation, the labels revert to the defaults.

If you select the Compact display check box, the scope completely fills the figure window. The scope does not display menus and axis titles, but it does show the numerical axis labels within the axes. If you clear the Compact display check box, the scope displays the axis labels and titles in a gray border surrounding the scope axes, and the window's menus and toolbar become visible.

If you select the Open scope at start of simulation check box, the scope opens at the start of the simulation. If you clear this parameter, the scope does not open automatically during the simulation. You can use this feature when you have several scope blocks in a model, and you do not want to view all the associated scopes during the simulation.

 Note:   Before running a model that contains a Vector Scope block in Accelerator, Rapid Accelerator, or External mode, you must select the Open scope at start of simulation check box. If you do not select this check box before running your model for the first time, the scope will not display your simulation data.

If you want to view a scope window that is not open during simulation, click Open scope immediately on the Display Properties pane of the desired Scope block.

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

```[left bottom width height] ```

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 Pane

The parameters that are available on the Axis Properties pane depend on the setting of the Input domain parameter on the Scope Properties pane.

Time Domain Inputs

When Time display limits is set to `Auto`, the block scales the horizontal axis of time-domain signals automatically. The range of the time axis is $\left[0,S\ast {T}_{fi}\right]$, where Tfi is the input frame period, and S is the Time display span (number of frames) parameter on the Scope Properties pane. The spacing between time points is ${T}_{fi}/\left(M-1\right)$, where M is the number of samples in each consecutive input frame.

When Time display limits is set to `User-defined`, the Minimum X-limit (s) and Maximum X-limit (s) parameters set the range of the horizontal axis.

Minimum Y-limit and Maximum Y-limit parameters set the range of the vertical axis. Setting these parameters is analogous to setting the `ymin` and `ymax` values of the MATLAB axis function.

The Y-axis label is the text displayed to the left of the y-axis.

Frequency Domain Inputs

The Frequency units parameter specifies whether the frequency axis values should be in units of Hertz or rad/sec. When the Frequency units parameter is set to `Hertz`, the spacing between frequency points is $1/\left(M\ast {T}_{s}\right)$, where Ts is the sample time of the original time-domain signal. When the Frequency units parameter is set to `rad/sec`, the spacing between frequency points is $2\pi /\left(M\ast {T}_{s}\right)$.

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 $\left[0,{F}_{s}\right)$, which is the same as 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 you select the Inherit sample time from input check box for frequency domain inputs, 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:

• Each frame of frequency-domain data shares the same length as the frame of time-domain data from which it was generated; for example, when the FFT is computed on the same number of points as are contained in the time-domain input.

• The sample period of the time-domain signal in the simulation is equal to the period with which the physical signal was originally sampled.

• Consecutive frames containing the time-domain signal do not overlap each other; that is, a particular signal sample does not appear in more than one sequential frame.

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

When Frequency display limits is set to `Auto`, the block scales the horizontal axis of frequency-domain signals automatically. To do this, the Vector Scope block needs to know the sample period of the original time-domain sequence represented by the frequency-domain data. Specify this period by entering a value for the Sample time of original time series parameter.

When Frequency display limits is set to `User-defined`, the Minimum frequency and Maximum frequency parameters set the range of the horizontal axis.

The Y-axis scaling parameter allows you to select `Magnitude` or `dB` scaling along the y-axis.

Minimum Y-limit and Maximum Y-limit parameters set the range of the vertical axis. Setting these parameters is analogous to setting the `ymin` and `ymax` values of the MATLAB axis function.

The Y-axis label is the text displayed to the left of the y-axis.

User-Defined Inputs

If you select the Inherit sample increment from input check box for user-defined input domains, 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, when 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 when the following conditions hold:

• The input is a nonoverlapping time series; the x-axis on the scope represents time.

• The input sample period (1/64 in the above example) is equal to the period with which the physical signal was originally sampled.

In cases where not all of these conditions hold, use the X display offset (samples) and Increment per sample in input parameters.

The X-axis title is the text displayed below the x-axis.

When X display limits is set to `Auto`, the block scales the horizontal axis of user-defined domain signals automatically. To do this, the Vector Scope block needs to know the spacing of the input data. Specify this spacing using the Increment per sample in input parameter, Is. This parameter represents the numerical interval between adjacent x-axis points corresponding to the input data. The range of the horizontal axis is $\left[0,M\ast {I}_{s}\ast S\right]$, where M is the number of samples in each consecutive input frame, and S is the Horizontal display span (number of frames) parameter that you specify in the Scope Properties pane.

When X display limits is set to `User-defined`, the Minimum X-limit (samples) and Maximum X-limit (samples) parameters set the range of the horizontal axis.

Minimum Y-limit and Maximum Y-limit parameters set the range of the vertical axis. Setting these parameters is analogous to setting the `ymin` and `ymax` values of the MATLAB `axis` function.

The Y-axis label is the text displayed to the left of the y-axis.

### Line Properties Pane

Use the parameters on the Line Properties pane to help you distinguish between two or more independent channels of data on the scope.

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

For example, 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).

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 StyleCommand to Type in Line Style ParameterAppearance

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.

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 StyleCommand to Type in Marker Style ParameterAppearance

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 `LineSpec (Line Specification)` 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.

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

ColorRGB EquivalentAppearance

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 the MATLAB function `ColorSpec` for more information about the color syntax.

### Vector Scope Window

The title that appears in the title bar of the scope window 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 View, Axes, and Channels menus.

The options in the View menu allow you to zoom in and out of the scope window:

• To zoom in on the scope window, you must first select View > Zoom In or click the corresponding `Zoom In` toolbar button ( ). You can then zoom in by clicking in the center of your area of interest, or by clicking and dragging your cursor to draw a rectangular area of interest inside of the scope window.

• To zoom in on the x-axis of the scope window, you must first select View > Zoom X, or click the corresponding ```Zoom X-Axis``` toolbar button ( ) on the scope window. You can then zoom in on the x-axis with a single click inside the scope window or by clicking and dragging the cursor along the x-axis over your area of interest.

• To zoom in on the y-axis of the scope window, you must first select View > Zoom Y or click the corresponding ```Zoom Y-Axis``` toolbar button ( ). You can then zoom in on the y-axis with a single click inside the scope window or by clicking and dragging the cursor along the y-axis over your area of interest.

• To return to the original view of the scope window, you have the following options:

• Select Full View from the View menu .

• Click the `Restore default view` toolbar button ( ) on the Vector Scope window.

• Right-click inside the scope window, and select ```Reset to Original View```.

 Note:   To zoom out in smaller increments, you can right-click inside of the scope window and select `Zoom Out`. You can also zoom out by holding down the Shift key and clicking the left mouse button inside the scope window.

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 Pane. Below are descriptions of other parameters in the Axes menu:

• Refresh erases all data on the scope display, except for the most recent trace.

• Autoscale resizes the y-axis to best fit the vertical range of the data.

 Note:   The Minimum Y-limit and Maximum Y-limit parameters on the Axis properties pane of the block dialog are not updated to display the numerical limits selected by the autoscale feature.
• Save Axes Settings allows you to save the current axes settings. When you select this option, the Minimum Y-limit and Maximum Y-limit parameters of the Axes Properties pane update with the current y-axes limits. The Time display limits (or Frequency display limits) parameter is set to `User-defined`, and the current x-axes limits are saved in the Minimum X-limit and Maximum X-limit (or Minimum Frequency and Maximum Frequency) parameters. To save these axes settings for your next MATLAB session, you need to resave your model.

• Save Scope Position updates the Scope position parameter on the Display Properties pane of the block dialog to reflect the scope window's current position and size. To make the scope window open at a particular location on the screen when the simulation runs, drag the window to the desired location, resize it, and select Save Scope Position from 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 Pane.

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 the View, Axes and Channels menus.

 Note   When you select Compact Display from the Axes menu, the scope window menus are no longer visible. Right-click in the Vector Scope window and click Compact Display in order to make the menus reappear.

## Dialog Box

### Scope Properties Pane

Input domain

Select the domain of the input. Your choices are `Time`, `Frequency`, or `User-defined`. Tunable.

Time display span (number of frames)

The number of consecutive frames to display (horizontally) on the scope at any one time. This parameter is visible when the Input domain parameter is set to `Time`.

Horizontal display span (number of frames)

The number of consecutive frames to display (horizontally) on the scope at any one time. This parameter is visible when the Input domain parameter is set to `User-defined`.

### Display Properties Pane

Show grid

Toggle the scope grid on and off.Tunable.

Frame number

If you select this check box, the number of the current frame in the input sequence appears in the Vector Scope window. Tunable.

Channel legend

Toggles the legend on and off. Tunable.

Compact display

Resizes the scope to fill the window. Tunable.

Open scope at start of simulation

Select this check box to open the scope at the start of the simulation. When this parameter is cleared, the scope does not open automatically during the simulation. Tunable.

 Note:   Before running a model that contains a Vector Scope block in Accelerator, Rapid Accelerator, or External mode, you must select the Open scope at start of simulation check box. If you do not select this check box before running your model for the first time, the scope will not display your simulation data.
Open scope immediately

If the scope is not open during simulation, select this check box to open it. This parameter is visible only while the simulation is running.

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

### Axis Properties Pane

The parameters that are available on the Axis Properties pane depend on the setting of the Input domain parameter on the Scope Properties pane. When `Time` is selected for the Input domain parameter, the following parameters are available on the Axis Properties pane:

Time display limits

Select `Auto` to have the limits of the x-axis set for you automatically, or `User-defined` to set the limits yourself in the Minimum X-limit (s) and Maximum X-limit (s) parameters.

Minimum X-limit (s)

Specify the minimum value of the x-axis in seconds. This parameter is only visible if the Time display limits parameter is set to `User-defined`. Tunable.

Maximum X-limit (s)

Specify the maximum value of the x-axis in seconds. This parameter is only visible if the Time display limits parameter is set to `User-defined`. Tunable.

Minimum Y-limit

Specify the minimum value of the y-axis. Setting this parameter is analogous to setting the `ymin` value of the MATLAB `axis` function. Tunable.

Maximum Y-limit

Specify the maximum value of the y-axis. Setting this parameter is analogous to setting the `ymax` value of the MATLAB `axis` function. Tunable.

Y-axis label

Specify text to be displayed to the left of the y-axis. Tunable.

When `Frequency` is selected for the Input domain parameter, the following parameters are available on the Axis Properties pane:

Frequency units

Choose the frequency units for the x-axis, `Hertz` or `rad/sec`. Tunable.

Frequency range

Specify the frequency range over which to plot the data. Tunable.

Inherit sample time from input

If you select this check box, the block computes the time-domain sample period from the frame period and frame size of the frequency-domain input. Use this parameter only when 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 it was generated. Tunable.

Sample time of original time series

Enter the sample period, Ts, of the original time-domain signal. This parameter is only visible when the Inherit sample time from input check box is not selected. Tunable.

Frequency display limits

Select `Auto` to have the limits of the x-axis set for you automatically, or `User-defined` to set the limits yourself in the Minimum frequency and Maximum frequency parameters.

Minimum frequency

Specify the minimum frequency value of the x-axis in Hertz or rad/sec. This parameter is only visible if the Frequency display limits parameter is set to `User-defined`. Tunable.

Maximum frequency

Specify the maximum frequency value of the x-axis in Hertz or rad/sec. This parameter is only visible if the Frequency display limits parameter is set to `User-defined`. Tunable.

Y-axis scaling

Choose either `dB` (decibel) or `Magnitude` scaling for the y-axis. Tunable.

Minimum Y-limit

Specify the minimum value of the y-axis. Setting this parameter is analogous to setting the `ymin` value of the MATLAB `axis` function. Tunable.

Maximum Y-limit

Specify the maximum value of the y-axis. Setting this parameter is analogous to setting the `ymax` value of the MATLAB `axis` function. Tunable.

Y-axis label

Specify text to be displayed to the left of the y-axis. Tunable.

When `User-defined` is selected for the Input domain parameter, the following parameters are available on the Axis Properties pane:

Inherit sample increment from input

When you select this check box, the block scales the horizontal axis by computing the horizontal interval between samples in the input frame from the frame period of the input. Use this parameter only when the input's sample period is equal to the period with which the physical signal was originally sampled. Tunable.

Increment per sample in input

Enter the numerical interval between adjacent x-axis points corresponding to the user-defined input data. This parameter is only visible when the Inherit sample increment from input check box is not selected. Tunable.

X display offset (samples)

Specify an offset for the x-axis display in samples. This parameter is only visible when the Inherit sample increment from input check box is not selected. Tunable.

X-axis title

Enter the text to be displayed below the x-axis. Tunable.

X display limits

Select `Auto` to have the limits of the x-axis set for you automatically, or `User-defined` to set the limits yourself in the Minimum X-limit (samples) and Maximum X-limit (samples) parameters.

Minimum X-limit (samples)

Specify the minimum value of the x-axis in samples. This parameter is only visible if the X display limits parameter is set to `User-defined`. Tunable.

Maximum X-limit (samples)

Specify the maximum value of the x-axis in samples. This parameter is only visible if the X display limits parameter is set to `User-defined`. Tunable.

Minimum Y-limit

Specify the minimum value of the y-axis. Setting this parameter is analogous to setting the `ymin` value of the MATLAB `axis` function. Tunable.

Maximum Y-limit

Specify the maximum value of the y-axis. Setting this parameter is analogous to setting the `ymax` value of the MATLAB `axis` function. Tunable.

Y-axis label

Specify text to be displayed to the left of the y-axis. Tunable.

### Line Properties Pane

Line visibilities

Enter `on` or `off` to specify the visibility of the various channels' scope traces. Separate your choices for each channel with by a pipe (|) symbol. Tunable.

Line styles

Enter the line styles of the various channels' scope traces. Separate your choices for each channel with by a pipe (|) symbol. Tunable.

Line markers

Enter the line markers of the various channels' scope traces. Separate your choices for each channel with by a pipe (|) symbol. Tunable.

Line colors

Enter the colors of the various channels' scope traces using the `ColorSpec` formats. Separate your choices for each channel with by a pipe (|) symbol. Tunable.

## Supported Data Types

PortSupported Data Types

Input

• Double-precision floating point

• Single-precision floating point

• Fixed point (signed and unsigned)

• Boolean

• 8-, 16-, and 32-bit signed integers

• 8-, 16-, and 32-bit unsigned integers