| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Signal Processing Blockset |
| Contents | Index |
| Learn more about Signal Processing Blockset |
Signal Processing Sinks
dspsnks4
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.
Note When the Buffer input and Specify FFT length parameters are both cleared, the block input length must be a power of two. |
The Spectrum units parameter allows you to specify the following information:
The type of measurement for the block to compute (Power Spectral Density or Mean-Square Spectrum)
The type of scaling for the block to use (linear or log)
You can set the Spectrum units parameter to one of the options shown in the following table.
| Spectrum Units | Measurement Type | Scaling |
|---|---|---|
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
Mo = buffer size
L = buffer overlap
Ts = input sample period
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:
If you clear the Specify FFT length check box and select Buffer input, the block uses the buffer size as the FFT size.
If you clear both the Specify FFT length and Buffer input check boxes, the block uses the input size as the FFT size.
If you select the Specify FFT length check box, the FFT length parameter appears in the dialog box. Enter the number of samples on which you want the block to perform the FFT. This value must be a power of two.
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.
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.
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:
The input to the block is the original signal, with no samples added or deleted (by insertion of zeros, for example).
The sample period of the time-domain signal in the simulation equals the sample period of the original time series.
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 the Frequency display offset is 0, the block displays the DC frequency (0 Hz) at 0 Hz.
When Frequency display offset is a nonzero value, the block displays the DC frequency (0 Hz) at the value specified in the Frequency display offset parameter. If you set the Frequency display limits parameter to User-defined, the block does not automatically relabel the frequency axis. However, if you set the Frequency display limits to Auto, the values displayed on the frequency axis shift according to the Frequency display offset parameter.
For example, if the block has the following settings:
Spectrum Units = Watts/Hertz
Spectrum Type = Two-sided ((-Fs/2...Fs/2])
Frequency display offset (Hz) = 0
Frequency display limits = Auto
Sampling frequency (Fs) = 1000 Hz
Then, based on these settings:
The values on the frequency axis of the spectrum scope range from -500 Hz to 500 Hz.
The block centers the DC frequency (0 Hz) at 0 Hz.
If you change the Frequency display offset (Hz) parameter to 100, the block:
Relabels the frequency axis such that the values range from -400 Hz to 600 Hz.
Centers the DC frequency (0 Hz) at 100 Hz.
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.
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 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.
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.
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 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.
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:
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 Spectrum Scope
window.
Right-click inside the scope window and select Reset to Original View.
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. This command is useful in conjunction with the Persistence setting.
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. See Zoom Capability for Spectrum Scope and Vector Scope Blocks in the Signal Processing Blockset Release Notes for more information. |
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 Frequency display limits parameter is set to User-defined, and the current x-axes limits are saved in the Minimum Frequency (Hz) and Maximum Frequency (Hz) parameters. To save these axes settings for your next MATLAB session, you need to resave your model.
Save Scope Position automatically updates the Scope position parameter in the Axis Properties pane of the block dialog. When you select Save Scope Position, the block saves the current position and size of the scope window. 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 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.
Note When you select Compact Display from the Axes menu, the scope window menus are no longer visible. Right-click in the Spectrum Scope window and click Compact Display to make the menus reappear. |
See Displaying Frequency-Domain Data in the Signal Processing Blockset User's Guide.

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 Units | Measurement Type | Scaling |
|---|---|---|
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.
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.
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.
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.
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.
Specify the type of window to apply. See the Window Function block reference page for more details. Tunable.
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.
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.
Choose Symmetric or Periodic. Tunable.
This parameter becomes visible only if Blackman, Hamming, Hann, or Hanning is selected for the Window parameter.
Select this check box to specify the FFT length yourself in the FFT length parameter.
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.
The number of spectra to average. Setting this parameter to 1 effectively disables averaging. See the Periodogram block reference page for more information.

Toggle the scope grid on and off. Tunable.
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.
If you select this check box, the number of the current frame in the input sequence appears in the Vector Scope window. Tunable.
Toggles the legend on and off. Tunable.
Resizes the scope to fill the window. Tunable.
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.
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.
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.

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.
Enter the sample period of the original time-domain signal.
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.
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.
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.
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.
Specify the minimum value of the y-axis. Setting this parameter is analogous to setting the ymin value of the MATLAB axis function.Tunable.
Specify the maximum value of the y-axis. Setting this parameter is analogous to setting the ymax value of the MATLAB axis function.Tunable.
Specify text for the block to display to the left of the y-axis. Tunable.

For more information about these parameters, see Line Properties Pane in the Vector Scope block reference page.
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.
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.
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.
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.
| Port | Supported Data Types |
|---|---|
Input |
|
| FFT | Signal Processing Blockset |
| Periodogram | Signal Processing Blockset |
| Short-Time FFT | Signal Processing Blockset |
| Vector Scope | Signal Processing Blockset |
| Window Function | Signal Processing Blockset |
![]() | Sort | Stack | ![]() |

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 |