Compute turbulent spectrum with Welch periodogram

Hi all,

I am computing turbulence density spectrum with Welch periodogram. The results seem good but I do not manage to find the fluctuation of streamwise velocity that I am supposed to find when computing the integral of the spectrum.

Here is my code:

sr = 833.3               # Sampling rate i.e. samples per second (1/dt with dt=0.0012)
Nysquid = sr/2

# Perform Welch's periodogram with hann window and 50% overlap
segment = int( seg_len*sr ) 
myhann = signal.get_window('hann', segment)

# obtain Power density with Hann window and 50% overlap
myparams2 = dict(fs = sr, nperseg = segment, window = myhann, 
                 noverlap = segment/2, scaling = 'density', return_onesided=True)

freqn, xn = signal.welch(x = xdat, **myparams2) #xdat is an array composed of the streamwise velocity at a given location and for every saved times. 

I compute the velocity fluctuation from the measured data as:

   U_std= np.std(U)

I compute the velocity fluctuation from the spectrum as:


The ratio between the two results (uu/Euu) is close to 1 (which is the expected value) but not exactly (lying between 0.5 and 1.5 depending on the location in the flow). Why I cannot found Euu=uu?

Thanks a lot!

This sounds like it’s really a question about the underlying mathematics or other domain knowledge, rather than a question about programming.