DFT Vs FFT PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

DFT Vs FFT For Fourier Analysis of Waveforms

Introduction

A distorted, periodic waveform can be shown to consist of a series of sinusoidal


waveforms (harmonic components) at frequencies that are integral multiples of the
fundamental frequency. Such a waveform can be analyzed using Fourier Analysis to
determine the magnitude and phase of these components. This note demonstrates why
the Discrete Fourier Transform (DFT) technique provides much better results than a Fast
Fourier Transform (FFT) when analyzing such a waveform.

Example Waveform

To illustrate the difference between the DFT and FFT techniques, consider the following
example waveform which consists of a 120Hz fundamental component with a magnitude
of 170V, and a 5th harmonic at 30% of the magnitude of the fundamental (51V).

Figure 1

DFT Vs FFT For Fourier Analysis of Waveforms Page 1 of 7


Sampling

Let us assume that we are sampling the waveform in figure 1 at 100kHz, and that these
samples will be analyzed using Fourier Analysis.

Fourier Analysis

The principle of Fourier Analysis is to ‘test’ for the presence of each frequency
component by multiplying the waveform, f(t), by a sine and cosine waveform of the same
test frequency and average the results over one or more cycles of the test frequency.
For example:


a (n) = 2 ∫ f (t ) x sin( nωt ) in phase component
0

b(n) = 2 ∫ f (t ) x cos(nωt ) quadrature component
0

Figure 2

The magnitude of the harmonic can easily be determined as:

1
m( n) = ( a ( n) 2 + b( n) 2 ) 2

Figure 3

In the case of digital Fourier Analysis, the sample waveform is multiplied by numbers
representing the sample of the test sine and cosine waveforms.

DFT

In the case of the DFT analysis used by Voltech, the first step is to determine the
fundamental frequency of the waveform to be analyzed.

In most power / power electronic applications the calculation of the fundamental


frequency is relatively easy to do using the voltage waveform, the current waveform or,
in special cases, an external signal from the electronic control circuit.

DFT Vs FFT For Fourier Analysis of Waveforms Page 2 of 7


Measurement of the fundamental frequency is the key to obtaining precise results in the
Fourier Analysis.

As mentioned previously, Fourier Analysis consists of multiplying the waveform to be


analyzed by a digital representation of sine and cosine waveforms of the test frequency.
A DFT allows the use of any integer number of samples in the analysis. In the example
is figure 1, there are 833.33 samples in one cycle of the measured waveform, and 833 is
the nearest integer number of samples to one cycle of the waveform. In other words, we
are analyzing over a ‘window’ that is very close to being exactly one cycle of the
repetitive waveform.

The result of this is to produce results that very accurately reflect the magnitude of each
of the actual components in the waveform.

e.g.

Harmonic Actual Amplitude DFT Result Error


1 (120Hz) 170.0V 170.0255V 0.015%
2 (240Hz) 0V 0.071181V
3 (360Hz) 0V 0.012796V
4 (480Hz) 0V 0.054622V
5 (600Hz) 51.0V 51.03817V 0.075%
6 (720Hz) 0.13432 0V
7 (840Hz) 0.079245 0V

Figure 4

The disadvantage of the DFT technique is that it requires each harmonic to be calculated
separately, which requires much more processing power. However, if that processing
power is available, then the DFT provides very accurate answers.

FFT

The FFT, or Fast Fourier Transform is a method of calculating harmonics not one at a
time, but as a group, using a special algorithm. The FFT requires much less processing
power than a DFT for the same number of harmonic results. An FFT however, requires
that the number of samples being analyzed to be a binary number e.g. a power of two.

In our example, the nearest binary number of samples to a whole cycle of the sampled
waveform is 1024. The number of samples represents a window of 1.228 cycles
(1024/833.3) of our waveform. This results in a base ‘test’ waveform frequency of
97.66Hz. In other words , the FFT analysis multiplies the waveform by sine and cosine
waves that do not match one cycle of the waveform. This is shown in figure 5 below.

DFT Vs FFT For Fourier Analysis of Waveforms Page 3 of 7


Figure 5

The results for a FFT are shown in figure 6 below.

Harmonic Actual DFT Result Error Hanning Hanning


Amplitude Error
1 (97.66Hz) 170.0V 155.2736V 8.663% 164.8767V 3.0137%
2 (195.32Hz) 0V 47.80526V 54.25884V
3 (292.98Hz) 0V 21.19538V 51.92185V
4 (390.64Hz) 0V 12.69208V 21.81927V
5 (488.3Hz) 51.0V 6.417511V 87.417% 18.65617V 63.4193%
6 (585.96Hz) 0V 39.80876V 37.45542V
7 (683.62Hz) 0V 16.55824V 27.40487V

Figure 6

DFT Vs FFT For Fourier Analysis of Waveforms Page 4 of 7


It can be seen that the mismatch in the analysis window because of being forced to use a
binary number of samples has produced a set of results that are considerably different to
the actual harmonic content.

This effect is well understood, and is often referred to ‘spectral leakage’ i.e. data shows
up in the wrong frequency. Various methods have evolved to improve the results, such as
applying a ‘window’. On of the more common windows is the Hanning window. The
Hanning window is applied to the base data by multiplying the Hanning value by the
sampled value. The Fourier Transform is calculated on resultant data. Since the Hanning
window has a value of zero and the beginning and end, the window helps reduce the
effects of the discontinuity between the sampled waveform and the test waveform. The
affects of applying a Hanning window are showed in figure 6 above. At best, this will
improve values for certain frequencies, and worsen the results for others. Figure 7 below
shows the equation for the Hanning Window, along with its shape.

2π n
w(n) Hanning = 1
2
[Cos ( )] n = 0,1,2,...N-1
N
where N is the number of samples being analyzed

Figure 7

Other types of windowing include Hamming, Blackman and Flat Top. Each windowing
method has its advantages and disadvantages, so the choice of window used can often
dramatically affect the results obtained.

How Much Faster?

As their name implies, Fast Fourier Transforms are faster than Discrete Fourier
Transforms. But how much faster are they, and does this have an implication in the
analysis of power?

For a waveform of 1024 samples, N, it takes N2 computations to calculate the harmonics,


while for a FFT it takes Nlog2(N) computations. So, for the DFT it takes 1,048,576
computations and for the FFT it takes 10,240 computations. The FFT is over 100 times
faster. However, the number of computations given is for calculating 1024 harmonics
from 1024 samples.

DFT Vs FFT For Fourier Analysis of Waveforms Page 5 of 7


In power analysis, 1024 harmonics is not very realistic. A more realistic number of
harmonics would be 100. In this case, the FFT will still take 10,240 computations, but
the DFT will now only take 102,400 computations, or 10 times as many.

The figures given above show an indication of the performance difference between a
DFT and an FFT in a real-world situation. In today’s world of high performance DSPs, it
is relatively straight forward to compute the desired number of harmonics in a timely
manner using a DFT, and retain the advantage of the precision provided by using a DFT.

DFT Vs FFT For Fourier Analysis of Waveforms Page 6 of 7


Conclusion
Whilst the FFT technique is valuable technique for determining the harmonic content of
waveforms, it’s value lies where attempting to provide a spectrum analysis of waveforms
for while the base frequency cannot be determined, In these cases the DFT offers no
accuracy advantage, and the FFT provides more results for the same processing power.

In practical power electronic applications, where the fundamental frequency can be


determined with good accuracy, the DFT offers superior performance, precisely
identifying both the frequency and the amplitude of all the components that make up the
distorted waveform, thereby greatly helping the analysis and reduction of these
harmonics.

Also, although the FFT is significantly faster that a DFT, in practical power applications,
where only a limited number of harmonics are required, more accurate DFT calculation
can be carried out in real-time, so there is no need to sacrifice performance for speed.

For these reasons, the IEC, after a lengthy consideration of the FFT technique versus the
DFT technique, concluded that the DFT is the superior technology for analyzing current
harmonics in power waveforms, and has now embodied the requirement for DFT analysis
in the latest version of IEC 61000-4-7: Testing and Measurement Techniques, which is
specified in IEC 61000-3-2: Limits for harmonics current emissions.

DFT Vs FFT For Fourier Analysis of Waveforms Page 7 of 7

You might also like