Products & Services Solutions Academia Support User Community Company

Learn more about Signal Processing Blockset   

Spectrum Scope - Compute and display periodogram of each input signal

Library

Signal Processing Sinks

dspsnks4

Description

The Spectrum Scope block computes and displays the periodogram of the input. The input can be a sample-based or frame-based vector or a frame-based matrix.

Scope Properties Pane

The Spectrum units parameter allows you to specify the following information:

You can set the Spectrum units parameter to one of the options shown in the following table.

Spectrum UnitsMeasurement TypeScaling

Watts

Mean-Square Spectrum (MSS)Linear

dBW

dBm

Mean-Square Spectrum (MSS)Logarithmic

Watts/Hertz

Power Spectral Density (PSD)Linear

dBW/Hertz

dBm/Hertz

Power Spectral Density (PSD)Logarithmic

The X-axis units are always expressed in Hertz. The spacing between frequency points is 1/(NfftTs).

The Spectrum type parameter specifies the range of frequencies over which the block computes the spectrum. The available options are One-sided ([0...Fs/2]) and Two-sided ((-Fs/2...Fs/2]), where Fs is the sampling frequency of the original time-domain signal. Both the one-sided and two-sided options compute the full power spectrum. The Spectrum Scope block only supports One-sided ([0...Fs/2]) spectrums for real input signals.

Other Signal Processing Blockset FFT-based blocks, including the blocks in the Power Spectrum Estimation library, always compute the FFT at frequencies in the range [0,Fs).

Select the Buffer input check box when the input to the block is sample based. You can also use buffering for frame-based inputs, but it is optional. When the block buffers the input, the Buffer size parameter specifies the number of input samples to buffer before computing and displaying the magnitude FFT. You also use the Buffer overlap parameter to specify the number of samples from the previous buffer to include in the current buffer. To compute the number of new input samples the block acquires before computing and displaying the magnitude FFT, subtract the buffer overlap from the buffer size.

The display update period is

where

For negative buffer overlap values, the block discards the appropriate number of input samples after the buffer fills. The block also updates the scope display at a slower rate than in the zero-overlap case.

The Window and Window sampling parameters apply to the specification of the window function. See the Window Function block reference page for more details on these parameters.

The block determines the FFT length, Nfft, in the following ways:

The block zero pads or wraps the buffer of each channel to the FFT length before computing the FFT.

The value of the Number of spectral averages parameter determines the number of spectra to average. Setting this parameter to 1 effectively disables averaging. See the Periodogram block reference page for more information.

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 Persistence check box, 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.

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

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

If you select the Inherit sample time from input check box, the block computes the frequency data from the sample period of the input to the block. For the block to produce valid output, the following conditions must hold:

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

When you set the Frequency display limits to Auto, the block displays the full spectrum over the frequency range specified by the Spectrum type parameter.

The Frequency display offset parameter allows you to offset the range of values displayed on the frequency axis of the Spectrum Scope.

When you set the Frequency display limits to User-defined, the Minimum frequency (Hz) and Maximum frequency (Hz) parameters set the range of the horizontal axis.

Minimum Y-limit and Maximum Y-limit parameters allow you to set the range of the vertical axis. Setting these parameters equates 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 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.

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.

Spectrum 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 Spectrum 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:

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:

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 are also accessible by right-clicking 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.

Examples

See Displaying Frequency-Domain Data in the Signal Processing Blockset User's Guide.

Dialog Box

Scope Properties Pane

Spectrum units

Specify the spectrum units as described in the following table. The specified units determine the type of measurement to compute (Mean-Square Spectrum or Power Spectral Density). They also determine the type of Y-axis scaling (linear or logarithmic).

Spectrum UnitsMeasurement TypeScaling

Watts

Mean-Square Spectrum (MSS)Linear

dBW

dBm

Mean-Square Spectrum (MSS)Logarithmic

Watts/Hertz

Power Spectral Density (PSD)Linear

dBW/Hertz

dBm/Hertz

Power Spectral Density (PSD)Logarithmic

You can only tune this parameter within the same Measurement type. The block cannot switch between computing the mean-square spectrum and the power spectral density while the simulation is running.

Spectrum type

Specify the range of frequencies over which to compute the magnitudes in the input. The available options are One-sided ([0...Fs/2]) and Two-sided ((-Fs/2...Fs/2]), where Fs is the sampling frequency of the original time-domain signal. If you select One-sided ([0...Fs/2]), the input signal must be real-valued. Tunable.

Buffer input

Select this check box to rebuffer the input data. Sample-based inputs require that you select this check box. However, it is optional for frame-based inputs.

The toolbox does not support this functionality for use with external mode. Instead, clear this check box and use a Buffer block before the Spectrum Scope in your model.

Buffer size

Specify the number of input samples that the block buffers before computing and displaying the magnitude FFT. If you do not select the Specify FFT length check box, the Buffer size must be a power of two.

This parameter becomes visible only when you select the Buffer input check box.

Buffer overlap

Specify the number of samples from the previous buffer to include in the current buffer. To compute the number of new input samples the block acquires before computing and displaying the magnitude FFT, subtract the buffer overlap from the buffer size.

This parameter becomes visible only when you select the Buffer input check box.

Window

Specify the type of window to apply. See the Window Function block reference page for more details. Tunable.

Stopband attenuation in dB

Enter the level, in decibels (dB), of stopband attenuation, Rs, for the Chebyshev window. Tunable.

This parameter becomes visible only when you select Chebyshev for the Window parameter.

Beta

Enter the β parameter for the Kaiser window. Increasing Beta widens the mainlobe and decreases the amplitude of the sidelobes in the displayed frequency magnitude response. Tunable.

This parameter becomes visible only if you select Kaiser for the Window parameter.

Window sampling

Choose Symmetric or Periodic. Tunable.

This parameter becomes visible only if Blackman, Hamming, Hann, or Hanning is selected for the Window parameter.

Specify FFT length

Select this check box to specify the FFT length yourself in the FFT length parameter.

FFT length

Enter the number of samples on which you want the block to perform the FFT. The value you specify must be a power of two.

This parameter becomes visible only when you select the Specify FFT length check box.

Number of spectral averages

The number of spectra to average. Setting this parameter to 1 effectively disables averaging. See the Periodogram block reference page for more information.

Display Properties Pane

Show grid

Toggle the scope grid on and off. Tunable.

Persistence

Select this check box 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. 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 you clear this parameter, the scope does not automatically open during the simulation. Tunable.

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

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 each frame of frequency-domain data equals the frame length of the time-domain data that generated it.

Sample time of original time series

Enter the sample period of the original time-domain signal.

Frequency display offset

The Frequency display offset parameter allows you to offset the range of values displayed on the frequency axis of the Spectrum Scope. The value specified in this field becomes the new label for the DC frequency (0 Hz). See the example in the Axis Properties Pane section for more information.

Frequency display limits

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

Minimum frequency (Hz)

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

Maximum frequency (Hz)

Specify the maximum frequency value of the x-axis in Hertz. This parameter is only visible if the Frequency 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 for the block to display to the left of the y-axis. Tunable.

Line Properties Pane

For more information about these parameters, see Line Properties Pane in the Vector Scope block reference page.

Line visibilities

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

Line styles

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

Line markers

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

Line colors

Enter the colors of the scope traces for various channels using the MATLAB 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

See Also

FFTSignal Processing Blockset
PeriodogramSignal Processing Blockset
Short-Time FFTSignal Processing Blockset
Vector ScopeSignal Processing Blockset
Window FunctionSignal Processing Blockset

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS