Engee documentation

Spectrum analyser

A spectrum analyser is a tool for analysing the frequency composition of a signal. The spectrum analyser is based on the Fast Fourier Transform method.

To configure the spectrum analyser:

  1. Open Graphs graphs icon 1 .

  2. Select the type of signal display Frequency domain signals signal graph 2 using the button Signal Menu signal menu 1.

  3. In tools, click on the button Settings settings button 1 and go to Spectrum analyzer.

Spectrum analyser interface

The spectrum analyser interface consists of the following settings:

spector analyzer 1


Input domain - working with the time domain of the signal
Time

Details

The input signal you feed to the spectrum analyser is represented as a time sequence and the spectrum will be analysed in the context of that time.

Spectrum type - type of spectral analysis
Power (by default) | Power density

Details

Indicates the type of spectral analysis. It has two values - Power и Power density. Both values affect the setting of the parameters Units:

  • Power density - divides the modulus value of the spectrum by the frequency, allows to analyse the spectrum in the frequency range:

    .

  • Power - leaves the spectrum modulus value unchanged (removes the division), allows to analyse the signal spectrum by amplitude:

    .

View - type of presentation of the results of signal spectrum analysis
Spectrum (By default)

Details

The view can be represented using the single parameters - Spectrum. This means that you will get the results of the analysis as a spectrum of the signal. Represented by only one option.

Sample rate (Hz) - speed of measurement or sampling of the signal in time
100 (By default)

Details

The setting indicates the number of signal samples recorded during one second. It is set as a positive scalar number.

Dependencies

  • If the parameters checkbox is enabled (default), the sampling rate will be automatically determined based on the input signal characteristics. Inherit is enabled (by default), the sampling frequency will be automatically determined based on the characteristics of the input signal. In this case, the spectral analysis will be performed based on the automatically determined sampling rate.

  • If the checkbox of parameters Inherit off, the sampling frequency of the signal will be set to a certain value specified in the parameters Sample rate (Hz). This means that the spectrum analysis will be carried out taking into account this sampling frequency, and the analysis results will be displayed for this frequency.

Spectrum estimation method - method of spectrum analysis
Welch (By default)

Details

As a spectrum analysis method, Engee uses the method Welch. Read more in the section Welch’s method. It is represented by only one variant.

Full frequency span - possibility to set frequency values
On (By default) | Off

Details

Parameters determines whether the entire available frequency range in the signal will be analysed or only a certain range will be used.

  • On (By default) - the spectrum analyser will cover all frequencies available in the signal from 0 (minimum) to infinity (maximum).

  • Disabled - the spectrum analyser will cover only the manually defined range.

Dependencies

To enable parameters FStop (Hz) и Span (Hz) uncheck the box Full frequency span.

FStart (Hz) - initial value of the frequency coverage range
Not set (By default)

Details

Parameters allows you to manually define the set value of the frequency coverage range (at the beginning of the range). It is set as a positive scalar number.

Dependencies

When selecting the parameters FStart (Hz) automatically adds the parameters FStop (Hz).

FStop (Hz) - end value of the frequency coverage range
Not set (By default)

Details

Parameters allows you to manually define the set value of the frequency coverage range (at the end of the range). It is set as a positive scalar number.

Span (Hz) - range of values around the centre frequency
Not set (By default)

Details

Used to set the range of analysis values around a point (centre frequency) on the frequency axis.

Dependencies

When parameters are selected Span (Hz) automatically adds the parameters CF (Hz) (centre frequency).

CF (Hz) - centre frequency
0 (By default)

Details

The centre frequency around which the signal is processed as a positive scalar number.

By default, the spectrum analyser is set CF (Hz) to the middle of the range to ensure uniform frequency coverage.

RBW (Hz) - frequency resolution
Not set (By default)

Details

The parameters denotes the frequency resolution of the displayed spectrum and determines how accurately we can display the frequency components of the signal in the analysis. The lower the value *RBW (Hz)*value, the higher the resolution of the spectrum analyser, but also the more signal samples (simulation time) are required for measurements.

Parameters RBW (Hz) parameter directly affects the signal display in the frequency domain:

  • If the parameters RBW (Hz) If the parameter has automatic value detection, the graph in the frequency domain will be displayed if the condition is met:

    ,

    where 1536 is the minimum number of data points required to plot in the frequency domain, obtained from Henning window function. To obtain the minimum number of points, either increase the Simulation time or decrease the Sample time (calculation step). The formula applies to both Time Based and Sample Based blocks.

  • If the parameters RBW (Hz) parameter has a specific value, the graph will be displayed if the condition is met:

    ,

    where N_"samples" is the minimum required number of points. NENBW - constant depending on the selected window function. In Engee this is the Henning window function, so the value of the constant is 1.5. - sampling frequency.

Units - selection of units for the amplitude of spectral components of the signal
dBm (by default) | dBW | Watts

Details

Parameters defines the units for the amplitude of the spectral components of the signal in decibel milliwatts (dBm), decibel watts (dBW) and watts (Watts).

Averaging method - selection of spectrum averaging method
Exponential (by default) | Running

Details

Parameters defines the averaging method used to reduce noise and variation in the spectrum data, making the spectrum smoother and more suitable for analysing stationary signal components. Two methods are available:

  • Exponential - Uses a weighted average of the current and previous values of the signal spectrum samples. The weight of the previous spectrum values decreases exponentially with a "forgetting" factor, which is set in the field of the parameters value Forgetting rate.

  • Running - uses the working average of the last samples for data smoothing.

Forgetting rate - numeric entry of sample weight
0.9 (by default)

Details

Numerical entry of sample weight from 0 to 1.

Dependencies

To use this parameter, set the parameters to Averaging method value Exponential.

Scale - displaying frequency values on the spectrum graph axes
Linear (by default) | Log

Details

Two options for displaying the scale are presented:

  • Linear - frequencies are distributed uniformly with a constant step between each point. This means that each interval on the frequency axis has the same length and changes in frequency are displayed proportionally on the graph.

  • Log - frequencies increase according to a logarithmic function, which results in a uniform distribution of values on the axis in the case of exponential growth or decrease.

Dependence

Enabling the checkbox Two-sided spectrum blocks the usage of the parameters Scale.

Offset (Hz) - defines the value of the constant component of the signal shifting along the frequency axis on the spectral plot
0 (By default)

Details

Parameters Offset (Hz) indicates the frequency by which the signal is shifted in the spectral representation. For example, if the constant offset frequency is 100 Hz, the entire spectrum will be shifted by 100 Hz to the right or left relative to the zero frequency. By default, the spectrum will not be shifted.

Two-sided spectrum - a way of visualising the spectrum of a signal that displays both positive and negative frequencies
On (By default) | Off.

Details

With the parameters enabled, the frequency axis is centred around zero and both positive (doubled) and negative (halved) frequency values are plotted. This allows you to simultaneously see both the amplitude characteristics of the signal at both positive and negative frequencies.

Example

Let’s consider the principle of spectrum analyser operation by example. For this purpose let’s build a model of two blocks of sinusoidal sources DSP Sine Wave from the library of digital signal processing and a block of pseudo-random sequence source (noise source) Uniform Random Number. Let’s complete the model using the input signal addition or subtraction block Add and the stub for the output port Terminator. The result is the following model:

pulse gen 3

Let’s change the settings of blocks and solver:

Sine Wave DSP

Amplitude = 4;
Frequency (Hz) = 20;
Sample time = 1/500

Sine Wave DSP-1

Amplitude = 4;
Phase offset (rad) = pi;
Frequency (Hz) = 20;
Sample time = 1/500

Uniform Random Number

Minimum = -0.5;
Maximum = 0.5;
Sample time = 1/500

Add

List of signs = + + + +

The number of is equal to the number of input ports of the block (by default, + +).

Resolver

Step size = 1/1e3

Enable signal recording signal logging 1 from block Add. (give the name Two_sine_noisy for convenience) and run the model simulation with the button Start start simulation button.

Open Graphs graphs icon 1 . The coordinate plane will display a graph in the time domain by default. To view the graph in the frequency domain, select the display type Frequency domain signals signal graph 2 в Signal Menu signal menu 1 toolbar of the graph window and tick the checkbox to display the Two_sine_noisy signal:

two sine noisy x1

Go to the spectrum analyser settings using the Settings button settings button 1 and select the tab Spectrum analyzer. To display the graph in the frequency domain, it is important to consider the frequency resolution parameters RBW (Hz):

rbw 1

  • If the parameters RBW (Hz) parameter has automatic value detection, the graph in the frequency domain will be displayed if the condition is met:

    ,

    where 1536 is the minimum number of data points required to plot in the frequency domain, obtained from Henning window function. To obtain the minimum number of points, either increase the Simulation time or decrease the Sample time (calculation step). The formula applies to both Time Based and Sample Based blocks.

    For example, the current model requires at least 3.2 seconds of simulation time because satisfies the condition.

  • If the parameters RBW (Hz) parameter has a specific value, the graph will be displayed if the condition is met:

    ,

    where is the minimum required number of points; is a constant depending on the selected window function. In Engee this is the Henning window function, so the value of the constant is 1.5. - sampling frequency.

    For example, for the current model Hz, Hz, . Let’s substitute the values into the top expression and see that we need at least 750 points to plot. In 1 second of simulation, the model gets 500 data points, so at least 1.5 seconds of simulation is needed.

To view the graph in the time domain, select the display type Time Domain Signals signal graph 1 в Signal Menu signal menu 1 and tick the box to display the Two_sine_noisy signal:

two sine noisy 1

Welch’s method

To operate the spectrum analyser in Engee, the Welch method is used.

The Welch method is a spectral analysis method used to estimate the power spectrum of a signal. It is a modification of the Fourier transform and improves the statistical properties of spectrum estimation by dividing the signal into overlapping segments and averaging their spectral estimates.

Description of the method’s operation

When Welch’s method is chosen, the power spectrum estimate is an averaged modified periodogram. The algorithm in the spectrum analyser consists of the following steps:

  1. The unit buffers the input signal into data segments by points. Each data segment is divided into overlapping data segments, each of length , overlapping at points. The data segments can be represented as:



    • If , the overlap is 50%.

    • If , the overlap is 0%.

  2. Apply the window to each of the overlapping data segments in the time domain.

    If the parameters Full frequency span is unchecked, you can set the length of the data window using the parameters Span (Hz) or with the parameters FStart (Hz) и FStop (Hz).

    If you set the parameters to Full frequency span value , the algorithm determines the length of the data window using this equation:

    .

    It then splits the input signal into multiple data segments with the window.

    Most windowing functions have a greater impact on the data in the centre of the set than on the data at the edges, which represents a loss of information. To mitigate this loss, the individual data sets are usually overlapped in time. For each segment with a window, compute the periodogram by discrete Fourier transform. Then calculate the square of the magnitude of the result and divide it by :

    where U is the power normalisation factor in the window function, which is defined as follows:

    .

  3. The spectrum analyser calculates and plots the power spectrum, power spectral density and RMS value using the modified periodogram estimation method.

    To determine the Welch power spectrum estimate, the spectrum analyser averages the periodogram results for the last data segments. Averaging reduces the variance compared to the original data segment from points.

    Here:

    • The spectrum analyser calculates the power spectral density using:

    • The power spectrum is the product of the power spectral density and the resolution bandwidth as shown in this equation:

    • In Spectrum the spectrum analyser plots the power spectrum as a spectrogram. Each line of the spectrogram is one periodogram. Time resolution of each line is equal to , which is the minimum achievable resolution. It may be necessary to combine several periodograms to achieve the desired resolution. Interpolation is used to calculate non-integer values. In the spectrogram display, time is scrolled from top to bottom, so the most recent data is shown at the top of the display. The offset shows the time value where the centre of the most recent spectrogram line is located.


The spectrum analyser requires a minimum number of samples to calculate a spectral estimate. This value is directly related to the resolution bandwidth ( ) using this equation:

or to the window length ( ) using Eq:

,

where is the percentage of overlap, is the normalised effective noise bandwidth, is the input sampling frequency, is the resolution bandwidth.

The spectrum analyser shows the number of samples per update in the status bar of the spectrum analyser. If the resolution method is set to , the window length is defined:

.