Welch Power Spectral Density and Averaged Spectrum

GX-TXT DEV112 P011-bis

Estimate the spectral density with Welch’s method and check the effect of windows, averages, units and plot scales.

Enable and select Welch

In Configuration → Modules → Analysis & Services select Welch PSD & Averaged Spectrum (analysis.welch_spectrum 1.2.0 in P011-bis). Press Enable module if Health is Available and the state is CORE / OFF. Go to Analysis and use Run / recalculate now to include it in the next run.

The module is available and can be enabled from Analysis & Services.
The module is available and can be enabled from Analysis & Services.

Generate a repeatable signal with two tones and noise

Open New Session… → Generate Session…. In the catalog GX-TXT Public Session Generators → Signal Processing select Welch PSD, ID welch_psd version 1.0.1. Use Standalone Session and generate the Session. The Generator produces welch.source with 32,768 samples in 32 s, tones at 50 and 123 Hz and reproducible synthetic white noise. clean_V contains only the tones, measured_V contains tones and noise, time_s is the common axis at 1024 Hz. In Dataset enable the source, check the type in Preview and read variables, units and origin in Technical details.

The Generator creates the two comparison columns and the Window Set.
The Generator creates the two comparison columns and the Window Set.

Define windows, signal and computation form

In Dataset sources bind welch.source to primary. Remove is disabled for the source with a mandatory role. In the bindings Time / temporal variable and Signal variable choose, respectively, primary.time_s and primary.measured_V. The menus also offer auto. To compare the effect of the noise, repeat the computation with primary.clean_V.

Temporal Window Set
The set must belong to the source and its time axis. None leaves a mandatory input missing. The Generator prepares tset_001, 2048 samples per window and step 1024, 50% overlap, without the last incomplete block. 31 windows are resolved.
Run mode
recalculate, chosen by the Generator, redoes the analysis. render_only redraws from a compatible cache. auto, the module default, decides based on the validity of the cache.
FFT weighting window
rectangular keeps constant weights, hann, the default, tapers the ends, hamming uses a residual weight at the ends, blackman reduces the side lobes further, blackman_harris suppresses them more with a wider main lobe and flat_top favors reading the amplitude around the peak. The choice affects the equivalent noise bandwidth and the distribution of the PSD.
Pre-FFT detrend / DC handling
none keeps the DC content, mean, the default, removes the mean per segment, linear subtracts the estimated trend.
NFFT mode / Explicit NFFT
auto uses the 2048-sample window and in this case gives 0.5 Hz between bins. explicit uses Explicit NFFT, initially 4096. With 4096 the step is 0.25 Hz. Use a value that contains the window. Zero-padding increases the number of spectral display points.
Parallel workers
auto delegates the choice, serial uses serial execution, a positive integer requests an explicit number. The lab starts with serial. The test at NFFT 4096 requested two workers.
Welch on the measured signal with the Generator’s overlapping set.
Welch on the measured signal with the Generator’s overlapping set.

Compare the densities and read the units

In Run check the plan, start the Analysis and wait for Selective analysis completed. Open Dataset → Preview to tell the source welch.source apart from the result welch.source.welch.v0003.tset_001. The binding clean_V produces welch.source.welch.v0002.tset_001. Open Open Dataset → Canonical table to look at frequency in Hz, psd in V²/Hz, asd in V/√Hz, mean_amplitude in V and psd_db with a unit PSD reference. A zero PSD value has no finite dB level. In Metadata read analysis.statistical_results. In Technical details check the format and identity of the output.

In Results, the file welch_spectrum_report.txt identifies 31 averaged, normalized one-sided densities, the peak frequency at 50 Hz and the integrated PSD. In the measured test with Hann and automatic NFFT you get about 0.419 V² and an equivalent bandwidth of 0.7504 Hz. On the clean signal you get 0.38125 V². The overlapping windows share samples, so the count of 31 does not represent 31 independent measurements.

The canonical Dataset also contains ASD and mean amplitude, in units different from the PSD.
The canonical Dataset also contains ASD and mean amplitude, in units different from the PSD.
The statistical metadata comes with the published Dataset.
The statistical metadata comes with the published Dataset.

Configure the Welch plot and the native variant

In the pane Graphs offered by module enable Welch spectrum to get 01_welch_spectrum.png. Enable all and Disable all set the plot selection together. Configure… opens the plot settings. Plot title changes the title. For X-axis label and Y-axis label uses auto for labels derived from quantity and unit, or write explicit labels.

Control
Spectral quantity
Use
psd_db, the default, shows the logarithmic level. psd_linear uses the linear density, asd its square root and mean_amplitude the mean amplitude of the segments.
Control
Frequency-axis scale / Y-axis scale
Use
linear, the default, uses linear increments. log requires positive coordinates. Use the log scale on Y on a positive linear quantity, and keep the reading of negative dB levels in a separate view.
Control
Additional output format
Use
none leaves the PNG, pdf or svg add the selected format.

Axes… opens the overrides for limits, ticks, scale and grid. Close closes the configuration. Module graphics… concerns the common values of the module. The commands Variants… and Series… refer to the variants and series of the plot. To customize the view of an already produced result, in Plots select Plot p0001 of the density, open Presentation → Title and labels…, change Graph title, save and use Render → Rerender. Graph → Open PNG 1:1 opens the PNG recomputed from the variant.

Welch configuration with quantity, scales and additional format.
Welch configuration with quantity, scales and additional format.
The Welch presentation variant before the title change.
The Welch presentation variant before the title change.
Welch plot reprocessed with an explicit title for the noisy signal.
Welch plot reprocessed with an explicit title for the noisy signal.

To repeat the ASD view, generate a second Welch Session. Before the first computation set Spectral quantity to asd, Frequency-axis scale to log, Y-axis scale to linear and Additional output format to svg. Use recalculate if the reopened Session reports an incompatible cache. The first computation in a new Session created the PNG of the ASD view and the SVG file of the variant. The Session with an already customized PSD variant kept the previous plot after the change in Configure.

Welch amplitude-density plot with frequency on a logarithmic scale.
Welch amplitude-density plot with frequency on a logarithmic scale.