Understand the frequency domain, time domain, FFT, and windowing to deepen your understanding of signals

Learn about the time and frequency domains of signals, Fast Fourier Transforms (FFTs), windowing, and how to use these operations to deepen your understanding of signals.

Learn about the time and frequency domains of signals, Fast Fourier Transforms (FFTs), windowing, and how to use these operations to deepen your understanding of signals.

Understand time domain, frequency domain, FFT

The Fourier transform helps to understand common signals and how to identify errors in them. Although the Fourier transform is a complex mathematical function, understanding the concept of the Fourier transform from a measurement signal is not complicated. Fundamentally, the Fourier transform decomposes a signal into sine waves of different amplitudes and frequencies. Let us continue to analyze the meaning of this sentence.

All signals are the sum of several sine waves

We usually think of an actual signal as a time-varying voltage value. This is looking at the signal from a time domain perspective.

Fourier’s law states that any waveform can be represented by the weighted sum of several sine and cosine waves in the time domain. For example, there are two sine waves, one with 3 times the frequency of the other. Add the two sine waves and you get a different signal.

Understand the frequency domain, time domain, FFT, and windowing to deepen your understanding of signals

Understand the frequency domain, time domain, FFT, and windowing to deepen your understanding of signals
Figure 1 Adding two signals to get a new signal

Assume that the amplitude of the second waveform is also 1/3 of the first waveform. At this point, only the peaks are affected.

Understand the frequency domain, time domain, FFT, and windowing to deepen your understanding of signals
Understand the frequency domain, time domain, FFT, and windowing to deepen your understanding of signals
Figure 2 Adjusting the amplitude affects the peak when the signals are added

Add a signal whose amplitude and frequency are only 1/5 of the original signal. Continue adding in this way until you hit a noise boundary and you may recognize the resulting waveform.

Understand the frequency domain, time domain, FFT, and windowing to deepen your understanding of signals
Understand the frequency domain, time domain, FFT, and windowing to deepen your understanding of signals
Figure 3 A square wave is the sum of several sine waves

You created a square wave. In this way, all signals in the time domain can be represented as a set of sine waves.

Even if a signal can be constructed this way, what does that mean? Because a signal can be constructed from a sine wave, the same can be said about decomposing a signal into a sine wave.

Once the signal is decomposed, the different frequencies in the original signal can be viewed and analyzed. Please refer to the following use cases for signal decomposition:

Breaks down the broadcast signal to select specific frequencies (stations) to listen to.

Breaking down an audio signal into signals of different frequencies (eg bass, treble) enhances specific frequency bands and removes noise.

Decomposing seismic waveforms according to velocity and intensity allows building designs to be optimized to avoid strong vibrations.

When decomposing computer data, the data with the least frequency importance can be ignored, which allows for a more compact use of memory. This is how file compression works.

Decomposing a Signal Using FFT

The Fourier transform transforms a time domain signal into a frequency domain signal. The frequency domain signal shows the voltage corresponding to different frequencies. The frequency domain is another angle to look at a signal.

A digitizer samples a waveform and converts the samples into discrete values. Fourier transform cannot be performed on these data because of the transformation. A discrete Fourier transform (DFT) can be used, the result of which is a discrete form of the frequency domain signal. FFT is an optimized implementation of DFT, which requires less computation, but essentially decomposes the signal.

Look at the signal in Figure 1 above. There are two signals with different frequencies. In this case, two vertical lines representing different frequencies are displayed in the frequency domain.

Understand the frequency domain, time domain, FFT, and windowing to deepen your understanding of signals
Figure 4 When two sine waves of the same amplitude are added together, they are displayed as two vertical frequency lines in the frequency domain

The amplitude of the original signal is represented on the vertical axis. In Figure 2 there are signals of different amplitudes. The highest vertical bar in the frequency domain corresponds to the highest voltage sinusoidal signal. Looking at the signal in the frequency domain, it is intuitive to see at which frequency the highest voltage occurs.

Understand the frequency domain, time domain, FFT, and windowing to deepen your understanding of signals
Figure 5 The highest vertical line is the frequency with the largest amplitude

The shape of the signal can also be observed in the frequency domain. For example, the shape of a square wave signal in the frequency domain. Create a square wave using sine waves of different frequencies. As can be expected, in the frequency domain, these signals will be represented as a vertical line, and each vertical line represents a sine wave that makes up a square wave. For example, in the frequency domain, the vertical line is displayed as a gradient, and it can be known that the original signal is a square wave signal.

Understand the frequency domain, time domain, FFT, and windowing to deepen your understanding of signals
Figure 6 The vertical line representing a sine wave in the frequency domain appears as a gradient

What does this look like in real life? Many mixed-signal oscilloscopes (MSOs) have FFT capabilities. In the image below, you can observe how a square wave FFT appears in a mixed signal graph. Spikes in the frequency domain can be observed after zooming in.

Understand the frequency domain, time domain, FFT, and windowing to deepen your understanding of signals

Understand the frequency domain, time domain, FFT, and windowing to deepen your understanding of signals
Figure 7 The upper image is the original sine wave and FFT, the lower image is the enlarged FFT, and the peaks representing the frequency can be observed

Observing the signal in the frequency domain helps to verify and find problems in the signal. For example, consider a circuit that outputs a sine wave. The time domain output signal can be viewed on an oscilloscope as shown in Figure 8. It looks like there is no problem!

Understand the frequency domain, time domain, FFT, and windowing to deepen your understanding of signals
Figure 8 If you add two very similar waveforms, you still get a perfect sine wave

When viewing a signal in the frequency domain, if the output sine wave is stable in frequency, it should only appear as a vertical line in frequency. However, it can be seen that there is still a vertical line at higher frequencies, indicating that the sine wave is not as perfect as observed. Try optimizing the circuit to remove noise at specific frequencies. Displaying the signal in the frequency domain helps find interference, noise, and jitter in the signal.

Understand the frequency domain, time domain, FFT, and windowing to deepen your understanding of signals
Figure 9 Looking at the seemingly perfect sine wave in Figure 8, it can be seen that there is a jitter in the waveform

signal windowing

FFTs provide new perspectives on a signal, but FFTs also have various limitations, and windowing can be used to increase the clarity of the signal.

What is windowing?

When using FFT to analyze the frequency content of a signal, you are analyzing a limited set of data. FFT considers a waveform as a finite set of data, and a continuous waveform is composed of several small waveforms. For FFT, both the time and frequency domains are ring topologies. In time, the front and rear endpoints of the waveform are connected. If the measured signal is a periodic signal, and there are exactly an integer number of cycles in the acquisition time, then the above assumption of FFT is reasonable.

Understand the frequency domain, time domain, FFT, and windowing to deepen your understanding of signals
Understand the frequency domain, time domain, FFT, and windowing to deepen your understanding of signals
Figure 10 Measuring an integer number of cycles (top) yields an ideal FFT (bottom)

In many cases, an integer number of cycles cannot be measured. As a result, the measured signal is cut off from the middle of the cycle and exhibits different characteristics than the time-continuous original signal. Limited data sampling can cause drastic changes in the measurement signal. Such drastic changes are called discontinuities.

When the collected period is non-integer, the endpoints are discontinuous. These discontinuities appear as high frequency components in the FFT. These high frequency components do not exist in the original signal. These frequencies can be much higher than the Nyquist frequency, causing aliasing in the frequency range from 0 to half the sampling rate. The frequency obtained using FFT is not the actual frequency of the original signal, but a changed frequency. Similar to the leakage of energy at one frequency to other frequencies. This phenomenon is called spectral leakage. Frequency leakage spreads good spectral lines over a wider signal range.

Understand the frequency domain, time domain, FFT, and windowing to deepen your understanding of signals
Understand the frequency domain, time domain, FFT, and windowing to deepen your understanding of signals
Figure 11 Measuring a non-integer number of cycles (top) adding spectral leakage to the FFT (bottom)

Windowing can be used to minimize errors from FFTs over a non-integer number of cycles. The boundaries of the finite sequence acquired by the digitizer exhibit discontinuities. Windowing reduces the magnitude of these discontinuities. Windowing consists of multiplying the time record by a window of finite length, the amplitude of which becomes progressively smaller and is 0 at the edges. The result of windowing is to present a continuous waveform as much as possible, reducing drastic changes. This method is also called applying a windowing.

Understand the frequency domain, time domain, FFT, and windowing to deepen your understanding of signals
Understand the frequency domain, time domain, FFT, and windowing to deepen your understanding of signals
Figure 12 Windowing minimizes spectral leakage

windowing function

Depending on the signal, different types of windowing functions can be selected. To understand how a window affects the frequency of a signal, it is necessary to first understand the frequency characteristics of a window.

The waveform diagram of the window shows that the window itself is a continuous spectrum, with one main lobe and several side lobes. The main lobe is the center of the frequency component of the time domain signal, and the side lobes are close to zero. The height of the side lobes shows the effect of the windowing function on frequencies around the main lobe. The sidelobe response to a strong sinusoidal signal may exceed the mainlobe response to a closer weak sinusoidal signal.

In general, low side lobes reduce FFT leakage, but increase the bandwidth of the main lobe. The fall-off rate of the sidelobe is the progressive decay rate of the sidelobe peak. Increasing the drop rate of the side lobes reduces spectral leakage.

Choosing a windowing function is not an easy task. Each windowing function has its own characteristics and scope of application. To choose a windowing function, you must first estimate the frequency content of the signal.

If your signal has strong interfering frequency components that are far away from the component of interest, then you should choose a smoothing window with a high sidelobe drop rate.

If your signal has strong interfering frequency components close to the component of interest, then you should choose a window with a low maximum sidelobe.

Spectral resolution is very important if the frequency of interest consists of two or more signals that are very close together. In this case, a smooth window with a narrow main lobe is preferred.

If the amplitude accuracy of a frequency component is more important than the precise position of the signal component within a certain frequency range, choose a wide main lobe window.

If the signal spectrum is flat or the frequency components are wide, use a unified window, or do not use a window.

In conclusion, the Hanning window is suitable for 95% of cases. It not only has better frequency resolution, but also reduces spectral leakage. If you don’t know the signal characteristics but want to use a smoothing window, then choose the Hanning window.

Even if no window is used, the signal is convolved with a rectangular window of uniform height. It is essentially equivalent to taking a screenshot of the input signal in the time domain, and it is also valid for discrete signals. The convolution has a spectrum characteristic of a sine wave function. For this reason, no windows are called uniform windows or rectangular windows.

Both Hamming windows and Hanning windows have the shape of a sine wave. Both windows produce broad peaks and low sidelobes. The Hanning window is zero at both ends of the window, eliminating all discontinuities. The Hamming window has non-zero ends at both ends of the window, and there will still be discontinuities in the signal. Hamming windows are good at reducing the nearest side lobes, but not good at reducing other side lobes. Hamming windows and Hanning are suitable for noise measurements that require high frequency accuracy and low side lobes.

Understand the frequency domain, time domain, FFT, and windowing to deepen your understanding of signals
Understand the frequency domain, time domain, FFT, and windowing to deepen your understanding of signals
Figure 13 Both Hamming and Hanning produce results with broad peaks and low side lobes

Blackman-Harris windows are similar to Hamming and Hanning windows. The resulting spectrum has wider peaks and side lobes are compressed. There are two main types of this window. The 4th-order Blackman-Harris is a general-purpose window with sidelobe suppression up to 90s dB and a wider mainlobe. The 7th-order Blackman-Harris window function has a wide dynamic range and a wide main lobe.

Understand the frequency domain, time domain, FFT, and windowing to deepen your understanding of signals
Understand the frequency domain, time domain, FFT, and windowing to deepen your understanding of signals
Figure 14 Blackman-Harris window results in wider peaks with sidelobe compression

The Kaiser-Bessel window achieves a good balance between amplitude accuracy, sidelobe distance and sidelobe height. The Kaiser-Bessel window is similar to the Blackman-Harris window in that, for the same main lobe width, the closer side lobes are higher and the further side lobes are lower. Selecting this window typically leaks the signal closer to the noise.

The Flat top window is also a sine wave, passing through the 0 line. The result of the Flat top window is a significantly broad peak in the frequency domain that is closer to the actual amplitude of the signal than the other windows.

Understand the frequency domain, time domain, FFT, and windowing to deepen your understanding of signals
Understand the frequency domain, time domain, FFT, and windowing to deepen your understanding of signals

Figure 15 Flat top window with more accurate amplitude information

Several common window functions are listed above. There is no one-size-fits-all method for choosing a window function. The table below can help you make your initial selection. Always compare the performance of window functions to find the most suitable one.

Understand the frequency domain, time domain, FFT, and windowing to deepen your understanding of signals

The Links:   BSM50GD120DN2 PD064VT2 IGBTMODULE