you are here:   / News & Insights / Engineering Advantage Blog / Random Data Analysis Part 3: The Fast Fourier Transform Inputs

Engineering Advantage

Random Data Analysis Part 3: The Fast Fourier Transform Inputs

September 18, 2015 By: Jonathan Dudley

In my previous post, I introduced the Fast Fourier Transform (FFT) and its use in unsteady data post-processing for CFD analysis. In this post, I would like to look a little deeper into the FFT and the required inputs. I will focus on the built in function in Python (Anaconda) to generate the FFT’s using Welch’s method. The function call I use is given below and I will walk through step by step.

Pxx,f =mpl.psd(pfluc,nfft,fs,window=mlab.window_hanning,scale_by_freq

The FFT Command Line and Welch’s Method:
Welch’s method is based on the concept of decomposing the acquired signal into segments, performing the FFT on individual blocks and taking the resulting ensemble-average of constructed periodograms. Welch's method may be considered an improvement on the standard spectrum methods as it reduces the noise in the estimated power spectra. The drawback is that it does this by reducing the frequency resolution (as nfft is smaller than N).

Figure 1. Welch’s method for FFT with no overlapping

Frequency Resolution:
Illustrated by Equation 1 below, in order to increase the frequency resolution (i.e. reduce Δf ), the ensemble period (T) must be increased. This is achieved by either reducing the sampling frequency (fs), or increasing the number of sampling points per ensemble (nfft).

This is the signal passed to the FFT that is assumed to be discretely sampled with a uniform sampling frequency. The mean has been removed from the signal resulting in just the fluctuating component of the variable.

For FFT’s, the signal will be decomposed into powers ofwhere “m” is specified by the user. Trailing data points after the last block is created are simply truncated.

Applying a “Window” to an FFT in essence modulates the input signal so that the spectral leakage is evened out. If we take a sine wave, you would expect to see just one sample at the frequency of the signal. Spectral leakage occurs due to the fact we are “binning” the data and sometimes the frequency calculated falls right at the edge of our bins. In this case, the power from the sample leaks out to the surrounding frequency bins and is referred to as spectral leakage. Windowing reduces the amplitude of the samples at the beginning and end of the window and alters this leakage. Windowing is implemented by multiplying the input signal with a windowing function. There are many common windowing functions, but for CFD and turbulent flows, I tend to prefer the Hanning window. The Hanning window is given by:

The scaling by frequency specifies whether the resulting spectral density values should be scaled by the scaling frequency, which gives density in units of . This allows for integration over the returned frequency values. Commonly, PSD’s are reported in terms of decibels in which case the PSD must be scaled using: where THH represents the Threshold of Human Hearing typically taken as 2e-05 [Pa].

One or Two-Sided:
Specifies which side of the spectrum to return.

Overlapping your data is a method to ensure you get the highest number of Nblocks increasing your averaging accuracy and frequency resolution by using repetitive data. As shown in Figure 2, we are in essence sliding our nfft segment back to the left reutilizing the defined percentage of overlap points.

Figure 2. Illustration of 50% overlapping

With the FFT fully defined, it is now time to exercise the code and discuss the results. Please watch for Part 4 of this series where I will demonstrate the use of the FFT and other related functions. Until then, happy FFT’ing! If you have further experiences or questions please feel free to add a comment!