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.

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.

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.
Noneleaves a mandatory input missing. The Generator preparestset_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_onlyredraws from a compatible cache.auto, the module default, decides based on the validity of the cache.- FFT weighting window
rectangularkeeps constant weights,hann, the default, tapers the ends,hamminguses a residual weight at the ends,blackmanreduces the side lobes further,blackman_harrissuppresses them more with a wider main lobe andflat_topfavors reading the amplitude around the peak. The choice affects the equivalent noise bandwidth and the distribution of the PSD.- Pre-FFT detrend / DC handling
nonekeeps the DC content,mean, the default, removes the mean per segment,linearsubtracts the estimated trend.- NFFT mode / Explicit NFFT
autouses the 2048-sample window and in this case gives 0.5 Hz between bins.explicituses 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
autodelegates the choice,serialuses serial execution, a positive integer requests an explicit number. The lab starts withserial. The test at NFFT 4096 requested two workers.

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.


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_linearuses the linear density,asdits square root andmean_amplitudethe mean amplitude of the segments.
- Control
- Frequency-axis scale / Y-axis scale
- Use
linear, the default, uses linear increments.logrequires 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
noneleaves the PNG,pdforsvgadd 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.



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.
