# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

# Spectrum Analyzer

Display frequency spectrum of time-domain signals

• Library:
• DSP System Toolbox / Sinks

## Description

The Spectrum Analyzer block, referred to here as the scope, displays the frequency spectra of signals.

The Spectrum Analyzer block accepts input signals that:

• Have discrete sample time

• Are real or complex valued

• Have a fixed number of channels of variable length

• Are floating or fixed point data

You can use the Spectrum Analyzer block in models running in Normal or Accelerator simulation modes. You can also use the Spectrum Analyzer block in models running in Rapid Accelerator or External simulation modes, with some limitations.

You can use the Spectrum Analyzer block inside all subsystems and conditional subsystems. Conditional subsystems include enabled subsystems, triggered subsystems, enabled and triggered subsystems, and function-call subsystems. See Conditional Subsystems (Simulink) for more information.

You can configure and display Spectrum Analyzer settings from the command line with `spbscopes.SpectrumAnalyzerConfiguration`.

For information about the Spectrum Analyzer System object™, see `dsp.SpectrumAnalyzer`.

## Ports

### Input

expand all

Connect the signals you want to visualize. You can have up to 96 input ports.

Data Types: `single` | `double` | `int8` | `int16` | `int32` | `uint8` | `uint16` | `uint32` | `Boolean` | `fixed point` | `enumerated`
Complex Number Support: Yes

## Parameters

expand all

### Spectrum Settings

The Spectrum Settings pane appears at the right side of the Spectrum Analyzer window. This pane controls how the spectrum is calculated. To show the Spectrum Settings, in the Spectrum Analyzer menu, select View > Spectrum Settings or use the button in the toolbar.

#### Main options

`Power` - Spectrum Analyzer shows the power spectrum.

`Power density` - Spectrum Analyzer shows the power spectral density. The power spectral density is the magnitude of the spectrum normalized to a bandwidth of 1 hertz.

`RMS` - Spectrum Analyzer shows the root mean squared spectrum.

Tunable: Yes

#### Programmatic Use

See SpectrumType.

`Spectrum` - Spectrum Analyzer shows the spectrum.

`Spectrogram` - Spectrum Analyzer shows the spectrogram, which displays frequency content over time. The most recent spectrogram update is at the bottom of the display, and time scrolls from the bottom to the top of the display.

`Spectrum and spectrogram` - Spectrum Analyzer shows both the spectrum and spectrogram.

Tunable: Yes

#### Programmatic Use

See ViewType.

Select `Inherited` to use the same sample rate as the input signal. To specify a sample rate, delete `Inherited` and enter a sample rate value.

#### Programmatic Use

See SampleRate.

Select `Welch` or `Filter Bank` as the spectrum estimation method. For more details about the two spectrum estimation algorithms, see Algorithms.

Tunable: No

#### Programmatic Use

See Method.

Select this check box to compute and plot the spectrum over the entire Nyquist frequency interval.

Tunable: Yes

#### Programmatic Use

See FrequencySpan.

Specify the frequency span in hertz. Use this parameter with the CF (Hz)parameter to define the frequency span around a center frequency. This parameter defines the range of values shown on the Frequency axis in the Spectrum Analyzer window.

Tunable: Yes

#### Dependencies

To use this parameter, you must:

• Clear the Full frequency span check box.

• Set the Span (Hz)/Fstart (Hz) dropdown to ```Span (Hz)```.

#### Programmatic Use

See FrequencySpan and Span.

Specify the center frequency, in hertz. Use this parameter with the Span (Hz) parameter to define the frequency span around a center frequency. This parameter defines the value shown at the middle point of the Frequency axis on the Spectrum Analyzer window.

Tunable: Yes

#### Dependencies

To use this parameter, you must:

#### Programmatic Use

See CenterFrequency.

Specify the start frequency in hertz. Use this parameter with the parameter to define the range of frequency-axis values using start frequency and stop frequency. This parameter defines the value shown at the leftmost side of the Frequency axis on the Spectrum Analyzer window.

Tunable: Yes

#### Dependencies

To use this parameter, you must:

• Clear the Full frequency span check box.

• Set the Span (Hz)/FStart (Hz) dropdown to ```FStart (Hz)```.

#### Programmatic Use

See StartFrequency.

Specify the stop frequency, in hertz. Use this parameter with the FStart (Hz) parameter to define the range of Frequency axis values. This parameter defines the value shown at the rightmost side of the Frequency axis on the Spectrum Analyzer window.

Tunable: Yes

#### Dependencies

To use this parameter, you must:

#### Programmatic Use

See StopFrequency.

The resolution bandwidth in hertz. This parameter defines the smallest positive frequency that can be resolved. By default, this parameter is set to `Auto`. In this case, the Spectrum Analyzer determines the appropriate value to ensure that there are 1024 RBW intervals over the specified frequency span.

If you set this parameter to a numeric value, the value must allow at least two RBW intervals over the specified frequency span. In other words, the ratio of the overall frequency span to RBW must be at least two:

 $\frac{span}{RBW}>2$ (2-1)

Tunable: Yes

#### Dependency

To use this parameter, set the RBW (Hz)/Window length/Number of frequency bands dropdown to `RBW (Hz)`.

#### Programmatic Use

See RBW.

The length of the window, in samples. The window length used to control the frequency resolution and compute the spectral estimates. The window length must be an integer greater than 2.

#### Dependencies

To use this parameter, set:

• Method to `Welch`

• Set the RBW (Hz)/Window length/Number of frequency bands dropdown to `Window Length`

#### Programmatic Use

See WindowLength.

Specify the fast Fourier transform (FFT) length to control the number of frequency bands. If the value is `Auto`, the Spectrum Analyzer uses the entire frame size to estimate the spectrum. If you specify the number of frequency bands, you set the input buffer size.

#### Dependencies

To use this parameter, set:

• Method to ```Filter Bank```

• Set the RBW (Hz)/Window length/Number of frequency bands dropdown to `Number of frequency bands`

#### Programmatic Use

See FFTLength

Specify the number of filter taps or coefficients for each frequency band. This value corresponds to the number of filter coefficients per polyphase branch. The total number of filter coefficients is equal to `NumTapsPerBand` + `FFTLength`.

#### Dependency

To use this parameter, you must set the RBW (Hz)/Window length/Number of frequency bands dropdown to Number of frequency bands.

#### Programmatic Use

See NumTapsPerBand.

Specify the length of the FFT that Spectrum Analyzer uses to compute spectral estimates. Acceptable options are `Auto` or a positive integer.

The NFFT value must be greater than or equal to the value of the Window length parameter. By default, when NFFT is set to `Auto`, the Spectrum Analyzer sets NFFT equal to the value of Window length. When in RBW mode, the specified RBW value is used to calculate an FFT length that equals the window length.

When this parameter is set to a positive integer, this parameter is equivalent to the `n` parameter of the `fft` function.

#### Dependencies

To use this parameter, you must set the RBW (Hz)/Window length/Number of frequency bands dropdown to Window length.

#### Programmatic Use

See FFTLength.

The number of input samples required to compute one spectral update. You cannot modify this parameter; it is shown in the spectrum analyzer for informational purposes only. This parameter is directly related to RBW (Hz)/Window length/Number of frequency bands. For more details, see Algorithms.

If the input does not have enough samples to achieve the resolution bandwidth that you specify, Spectrum Analyzer produces a message on the display.

#### Spectrogram Settings

Select the signal channel for which the spectrogram settings apply.

#### Dependencies

To use this option:

• Set View to `Spectrogram` or ```Spectrum and spectrogram```.

• There must be more than one signal channel input.

Time resolution is the amount of data, in seconds, used to compute a spectrogram line. The minimum attainable resolution is the amount of time it takes to compute a single spectral estimate. The tooltip displays the minimum attainable resolution given the current settings.

The time resolution value is determined based on frequency resolution method, the RBW setting, and the time resolution setting.

MethodFrequency Resolution MethodFrequency Resolution SettingTime Resolution SettingResulting Time Resolution in Seconds
`Welch` or `Filter Bank``RBW (Hz)``Auto``Auto`1/RBW
`Welch` or `Filter Bank``RBW (Hz)``Auto`Manually enteredTime Resolution
`Welch` or `Filter Bank``RBW (Hz)`Manually entered`Auto`1/RBW
`Welch` or `Filter Bank``RBW (Hz)`Manually enteredManually enteredMust be equal to or greater than the minimum attainable time resolution, 1/RBW. Several spectral estimates are combined into one spectrogram line to obtain the desired time resolution. Interpolation is used to obtain time resolution values that are not integer multiples of 1/RBW.
`Welch``Window length``Auto`1/RBW
`Welch``Window length`Manually enteredMust be equal to or greater than the minimum attainable time resolution. Several spectral estimates are combined into one spectrogram line to obtain the desired time resolution. Interpolation is used to obtain time resolution values that are not integer multiples of 1/RBW.
`Filter Bank``Number of frequency bands``Auto`1/RBW
`Filter Bank``Number of frequency bands`Manually enteredMust be equal to or greater than the minimum attainable time resolution, 1/RBW.

Tunable: Yes

#### Dependency

To use this option, set View to `Spectrogram` or ```Spectrum and spectrogram```.

#### Programmatic Use

See TimeResolution.

The time span over which the Spectrum Analyzer displays the spectrogram specified in seconds. The time span is the product of the desired number of spectral lines and the time resolution. The tooltip displays the minimum allowable time span, given the current settings. If the time span is set to `Auto`, 100 spectral lines are used.

Tunable: Yes

#### Dependency

To use this option, set View to `Spectrogram` or ```Spectrum and spectrogram```.

See TimeSpan.

#### Window Options

This parameter defines the amount of overlap between the previous and current buffered data segments. The overlap creates a window segment that is used to compute a spectral estimate. The value must be greater than or equal to zero and less than 100.

Tunable: Yes

#### Programmatic Use

See OverlapPercent.

The windowing method to apply to the spectrum. Windowing is used to control the effect of sidelobes in spectral estimation. The window you specify affects the window length required to achieve a resolution bandwidth and the required number of samples per update. For more information about windowing, see Windows (Signal Processing Toolbox).

Tunable: Yes

#### Programmatic Use

See Window.

The sidelobe attenuation in decibels (dB). The value must be greater than or equal to `45`.

#### Dependency

This parameter applies only when you set the Window parameter to `Chebyshev` or `Kaiser`.

#### Programmatic Use

The normalized effective noise bandwidth of the window. You cannot modify this parameter; it is shown for informational purposes only. This parameter is a measure of the noise performance of the window. The value is the width of a rectangular filter that accumulates the same noise power with the same peak power gain.

The rectangular window has the smallest NENBW, with a value of 1. All other windows have a larger NENBW value. For example, the Hann window has an NENBW value of approximately 1.5.

#### Trace Options

The units of the spectrum. The available values depend on the value of the Type parameter.

Tunable: Yes

#### Programmatic Use

See SpectrumUnits.

The full scale used for the dBFS units. By default, the Spectrum Analyzer uses the entire spectrum scale. Specify a positive real scalar for the dBFS full scale.

Tunable: Yes

#### Dependency

To enable this parameter, set Units to `dBFS`.

#### Programmatic Use

See FullScale.

Specify the number of spectral averages as a positive integer. The spectrum analyzer computes the current power spectrum estimate by computing a running average of the last N power spectrum estimates. This parameter defines the number of spectral averages, N.

#### Dependency

This parameter applies only when the View parameter is `Spectrum` or `Spectrum and spectrogram`.

#### Programmatic Use

See SpectralAverages.

The reference load in ohms that the Spectrum Analyzer uses as a reference to compute power values.

#### Programmatic Use

Choose a linear or logarithm scale for the frequency axis. When the frequency span contains negative frequency values, you cannot chose the logarithmic option.

#### Programmatic Use

See FrequencyScale.

The constant frequency offset to apply to the entire spectrum, or a vector of frequencies to apply to each spectrum for multiple inputs. The offset parameter is added to the values on the Frequency axis in the Spectrum Analyzer window. This parameter is not used in any spectral computations. You must take the parameter into consideration when you set the Span (Hz) and CF (Hz) parameters to ensure that the frequency span is within the Nyquist frequency interval.

#### Programmatic Use

See FrequencyOffset.

When this check box is selected, the Spectrum Analyzer calculates and plots the power spectrum or power spectrum density. Spectrum Analyzer performs a smoothing operation by averaging several spectral estimates.

#### Dependencies

To clear this check box, you must first select either the Max hold trace or the Min hold trace parameter. This parameter applies only when View is `Spectrum` or `Spectrum and spectrogram`.

#### Programmatic Use

See PlotNormalTrace.

Select this check box to enable Spectrum Analyzer to plot the maximum spectral values of all the estimates obtained.

#### Dependency

This parameter applies only when View is `Spectrum` or `Spectrum and spectrogram`.

#### Programmatic Use

See PlotMaxHoldTrace.

Select this check box to enable Spectrum Analyzer to plot the minimum spectral values of all the estimates obtained.

#### Dependency

This parameter applies only when View is `Spectrum` or `Spectrum and spectrogram`.

#### Programmatic Use

See PlotMinHoldTrace.

Select this check box to enable a two-sided spectrum view. In this view, both negative and positive frequencies are shown. If you clear this check box, Spectrum Analyzer shows a one-sided spectrum with only positive frequencies. Spectrum Analyzer requires that this parameter is selected when the input signal is complex valued.

### Configuration Properties

The Configuration Properties dialog controls visual aspects of the Spectrum Analyzer. To open the Configuration Properties, in the Spectrum Analyzer menu, select View > Configuration Properties or select the button in the toolbar dropdown.

Specify the display title as a character vector. Enter `%<SignalLabel>` to use the signal labels in the Simulink model as the axes titles.

Tunable: Yes

#### Programmatic Use

See Title.

Show signal legend. The names listed in the legend are the signal names from the model. For signals with multiple channels, a channel index is appended after the signal name. Continuous signals have straight lines before their names and discrete signals have step-shaped lines.

From the legend, you can control which signals are visible. This control is equivalent to changing the visibility in the Style parameters. In the scope legend, click a signal name to hide the signal in the scope. To show the signal, click the signal name again. To show only one signal, right-click the signal name, which hides all other signals. To show all signals, press ESC.

#### Dependency

To enable this parameter, set View to `Spectrum` or `Spectrum and spectrogram`.

#### Programmatic Use

See ShowLegend.

Show internal grid lines on the Spectrum Analyzer

#### Programmatic Use

See ShowGrid.

Specify the minimum value of the y-axis.

#### Programmatic Use

See YLimits.

Specify the maximum value of the y-axis.

#### Programmatic Use

See YLimits.

To display signal units, add `(%<SignalUnits>)` to the label. At the beginning of a simulation, Simulink® replaces `(%SignalUnits)` with the units associated with the signals. For example, if you have a signal for velocity with units of m/s enter

`Velocity (%<SignalUnits>)`

#### Programmatic Use

See YLabel.

Select the colormap for the spectrogram, or enter a three-column matrix expression for the colormap. For more information about colormaps, see `colormap`.

Tunable: Yes

#### Dependency

To use this parameter, set View to `Spectrogram` or ```Spectrum and spectrogram```.

Specify the signal power for the minimum color value of the spectrogram.

Tunable: Yes

#### Dependency

To use this parameter, set View to `Spectrogram` or ```Spectrum and spectrogram```.

#### Programmatic Use

See ColorLimits.

Specify the signal power for the maximum color value of the spectrogram.

Tunable: Yes

#### Dependency

To use this parameter, set View to `Spectrogram` or ```Spectrum and spectrogram```.

See ColorLimits.

### Style

The Style dialog controls how to Spectrum Analyzer appears. To open the Style properties, in the Spectrum Analyzer menu, select View > Style or select the button in the toolbar dropdown.

Specify the color that you want to apply to the background of the scope figure.

Specify whether to display a `Line` or `Stem` plot.

#### Programmatic Use

See PlotType.

Specify the color that you want to apply to the background of the axes.

Specify the channel for which you want to modify the visibility, line properties, and marker properties.

Specify whether the selected channel is visible. If you clear this check box, the line disappears. You can also change signal visibility using the scope legend.

Specify the line style, line width, and line color for the selected channel.

Specify marks for the selected channel to show at its data points. This parameter is similar to the 'Marker' property for plots. You can choose any of the marker symbols from the dropdown.

### Axes Scaling

The Axes Scaling dialog controls the axes limits of the Spectrum Analyzer. To open the Axes Scaling properties, in the Spectrum Analyzer menu, select Tools > Axes Scaling > Axes Scaling Properties.

Specify when the scope automatically scales the y-axis. If the spectrogram is displayed, specify when the scope automatically scales the color axis. By default, this parameter is set to `Auto`, and the scope does not shrink the y-axis limits when scaling the axes or color. You can select one of the following options:

• `Auto` — The scope scales the axes or color as needed, both during and after simulation. Selecting this option shows the Do not allow Y-axis limits to shrink or Do not allow color limits to shrink.

• `Manual` — When you select this option, the scope does not automatically scale the axes or color. You can manually scale the axes or color in any of the following ways:

• Select Tools > Scaling Properties.

• Press one of the Scale Axis Limits toolbar buttons.

• When the scope figure is the active window, press Ctrl+A.

• `After N Updates` — Selecting this option causes the scope to scale the axes or color after a specified number of updates. This option is useful, and most efficient, when your frequency signal values quickly reach steady-state after a short period of time. Selecting this option shows the Number of updates edit box where you can modify the number of updates to wait before scaling.

Tunable: Yes

#### Programmatic Use

See AxesScaling.

When you select this parameter, the y-axis is allowed to grow during axes scaling operations. If the spectrogram is displayed, selecting this parameter allows the color limits to grow during axis scaling. If you clear this check box, the y-axis or color limits can shrink during axes scaling operations.

#### Dependency

This parameter appears only when you select `Auto` for the Axis scaling or Color scaling parameter. When you set the Axes scaling or Color scaling parameter to `Manual` or `After N Updates`, the y-axis or color limits can shrink.

The number of updates after which the axes scale, specified as a positive integer. If the spectrogram is displayed, this parameter specifies the number of updates after which the color axes scales.

Tunable: Yes

#### Dependency

This parameter appears only when you set Axes scaling/Color scaling to ```After N Updates```.

Select this check box to scale the axes when the simulation stops. If the spectrogram is displayed, select this check box to scale the color when the simulation stops. The y-axis is always scaled. The x-axis limits are only scaled if you also select the Scale X-axis limits check box.

Set the percentage of the axis that the scope uses to display the data when scaling the axes. If the spectrogram is displayed, set the percentage of the power values range within the colormap. Valid values are from 1 through 100. For example, if you set this parameter to `100`, the scope scales the axis limits such that your data uses the entire axis range. If you then set this parameter to `30`, the scope increases the y-axis or color range such that your data uses only 30% of the axis range.

Tunable: Yes

Specify where the scope aligns your data along the axis when it scales the axes. If the spectrogram is displayed, specify where the scope aligns your data along the axis when it scales the color. If you are using CCDF Measurements, the x axis is also configurable.

Tunable: Yes

expand all