The words you are searching are inside this book. To get more targeted content, please make full-text search by clicking here.
Discover the best professional documents and content resources in AnyFlip Document Base.
Search
Published by Cambridge Paperbacks, 2019-04-29 07:13:00

Foturier Transform

Guide to the



Fourier Transform



and the


Fast Fourier Transform












Dr Allen Brown








Cambridge 
Paperbacks

Cambridge Paperbacks

www.CambridgePaperbacks.com


First published by Cambridge Paperbacks 2019



© Allen Brown 2019

All rights reserved. No part of this publication may be reproduced or
transmitted in any form or by any means, electronic or mechanical, including
photocopy, recording, or any information storage and retrieval system without
permission in writing from the author.



Disclaimer

Although the author and publisher have made every effort to ensure that the
information in this book was correct during preparation and printing, the
author and publisher hereby disclaim any liability to any party for any errors
or omissions.

Read this First


The Fourier Transform has now become a vitally

important component in the tool-kit of the practicing
engineer, scientist and technologist. The processing of

data and trying to make sense of it has long been the
challenge of every scientist. There are many software

tools on the market which greatly assist in this task

and it seems that MatLab has attracted a fair amount
of attention despite its rather awkward front end.


Given a stream of data, the need often arises to know

whether there is any periodic characteristics in the
data. This is where the Fourier Transform comes it –

to determine whether there are repetitive patterns in

the data. Enter the fray of frequency analysis. The
data stream may be contaminated by noise however

the Fourier Transform can usually indicate if there are
any frequency components present.


Having a really good understanding of the Fourier

Transform is therefore important and especially
knowing the limitations of the Transform.


Every chemistry graduate will recognise the

importance of Fourier Transform Spectroscopy and
they will have been taught how to use a commercial

spectrometer. Especially in the infrared (FTIR) for

providing chemical fingerprints for a wide range of
inorganic and organic samples.


Every mechanical engineer dealing with vibrations in
rotating machines will recognise the importance of

the Fourier Transform as one of their most important

analysis tools.

This flipbook has been written to provide a further

insight into how the Fourier Transform works, its

limitations and its practical implementation in the
form of the Fast Fourier Transform.


st
In the 21 century every scientist, engineer,
technologist and now computer scientist needs to
know about the Fourier Transform and how to use it.





Dr Allen Brown
Cambridgeshire

Contents

1 Introduction........................................................... 3

2 The Fourier Series .................................................. 7

2.1 Square Wave .................................................... 9

2.2 Triangular Wave ............................................. 10

2.3 Creating a Square Wave ................................. 14

2.4 Complex Fourier Series .................................. 15


3 The Fourier Transform ......................................... 17
3.1 Nature of Spectral Lines................................. 19


3.2 Resolving Power ............................................ 24

4 How the Fourier Transform Works ...................... 26

4.1 Why does F() need to be Complex? ............ 28

5 The Discrete Fourier Transform ........................... 30

5.1 Four Point DFT ............................................... 34

5.2 Resolution and Frequency Bins ..................... 36

5.3 Zoom DFT ...................................................... 36

5.4 Tracking .......................................................... 37

-1
5.5 Log10 and tan Algorithms ............................. 38
6 Pre-processing Data ............................................ 40

6.1 Data Windowing ............................................ 41

1

7 The Fast Fourier Transform ................................. 44

7.1 8-Point FFT ..................................................... 47

7.2 Bit Reversal .................................................... 52

7.3 Improvement in Execution Time ................... 53

7.4 Definitions ..................................................... 54

8 Commercial FFT Analysers .................................. 57

9 Running Fourier Transform ................................. 60

9.1 Deriving the RFT ............................................ 60


9.2 Using the RFT ................................................. 62
9.3 The Data Buffer .............................................. 64





















2

1 Introduction

Every engineer and scientist needs to know about be
Fourier transform. It is now an integral part of the

mathematical skill set that every engineer scientists
and technologists requires. A good understanding of

the Fourier transform is therefore essential for a every
practicing engineer and scientist.

In almost every area of engineering, science and

technology the Fourier Transform has become an
important tool. The reason for this is the ease of

implementation in digital technology. Before the
availability of digital signal processing integrated
circuits, performing the Fourier transform in the

analogue domain was no easy task.

However, once the availability of digital signal

processors became widespread, implementing of the
Fourier transform could be performed with relative
ease. In the of the 1980s and is 1990s we saw the

appearance of many DSP chips from several
manufacturers such as Fairchild, Motorola, Texas

Instruments and Analog Devices. Unfortunately the
market was not sufficient to support all these

manufacturers and there were casualties.


3

The key aspect all the Fourier Transform is its ability to
convert time of domain data into frequency domain

data. The Fourier Transform is defined as,

+∞
( ) = ∫ ( ) − 2 1.1
−∞
 
Frequency Time
Domain Domain

On first in view this equation may appear rather

confusing, and one of the best ways of thinking about
the Fourier Transform is to consider the refraction of

light passing through a glass
prism as seen in the diagram on

the left. As the white light
passes through the prism, it is

refracted into it’s seven colours
which emerge from the prism.
In effect the glass prism acts as

a Fourier Transformer on the incoming white light and
separates out all the different frequency components

in x(t). We can also define the inverse Fourier
Transform which recovers the time domain waveform

x(t) from the frequency spectrum,



4

1 ∞
( ) = ∫ ( ) 2
2 1.2
−∞


You will observe in Eq:1.1 for a perfect Fourier
Transform the integration needs to be performed over
infinite time. This is impracticable, and an

approximation is usually performed which is
expressed as,


1
( ) = ∫ ( ) − 2 1.3
0


It will be this function that we shall be focusing on and
to choose T to give the most accurate value of F(f).


For the Fourier Transform to provide the most

accurate measurement the signal must be stationary
over the time T. By this we mean,

• the amplitude of the signal must not change
• the frequency content must not change

• The phrases between the frequency
components must not change during T.

The signal therefore needs to be stationary for a
period of the T seconds. It is sometimes quite difficult

to judge how long T needs to be. In the case of audio

5

processing, most audio signal are stationary for about
40 ms. This is important which designing audio

encoders such as MP3 and MP4. There are two
definitions you will come across when referring to the

signal x(t):


( ) is an odd funtion when ( ) = − (− )
( ) is an even function when ( ) = (− )


To gain an understanding of how the Fourier
Transform is derived, you need to have some

knowledge all the Fourier Series.



















6

2 The Fourier Series


Jean-Baptiste Joseph Fourier
(21 March 1768 – 16 May
1830) was a French a

mathematician who did a lot
of work on heat transfer and

vibrations. He is also credited
with the discovery of the

greenhouse effect.

At the core of the Fourier

series is the superposition principle which states that
when several waveforms are added together they

create a single waveform.


Fourier stated that every periodic waveform
comprises a fundamental frequency added to an
infinite number of harmonics – integer related

frequencies. Expressed mathematically,

=∞
0 2 2
( ) = + ∑ [ cos ( ) + sin ( )] 2.1


2
=1

The fundamental frequency occurs when n = 1,


7

confusingly called the first harmonic. The true
harmonics (integer frequencies of the fundamental)

are for n = 2, 3, 4, … . The coefficients {an, bn} in Eq:2.1
determine the shape of the periodic waveform. Here

are some examples,























All these waveforms can be expressed in a Fourier
Series. The coefficients are calculated from the
following integrals,


1
= ∫ ( )
0
2 2.2


1 2
= ∫ ( ) cos ( ) 2.3





8

1 2
= ∫ ( ) sin ( )

− 2.4


We shall work through two examples, a square wave
and a triangular wave.



2.1 Square Wave

Consider the square wave as shown in Figure 2.1,










Figure 2.1 A square wave


You will observe from Figure 2.1 the value of x(t) is
given by,

1 0 ≤ ≤
( ) = {
0 < < 2

Coefficient a0, using Eq:2.2
1 1 1 1

= ∫ 1 = [ ] = =
0
0
2 0 2 2 2


Coefficients an, using Eq:2.3, also we note that = 2

9

1
= ∫ 1 cos( )


0

1 sin( ) 1
= [ ] = [sin( )]
0

0
1
= [sin( ) −sin( × 0)] = 0


Coefficients bn, using Eq:2.4

1 1 cos( ) 1
= ∫ 1 sin( ) = − [ ] = − [cos( ) − cos(0)]

0 0

1
= − [cos( ) − 1]


You will observe when n is even, will be zero and

when n is odd = 2/ . It’s only the odd harmonics

which are needed to create a square wave, each

weighted by 1/n.


2.2 Triangular Wave

Consider the triangular wave as shown in Figure 2.2.
From this figure, the value of x(t) is given by,

1 + − ≤ ≤ 0
( ) = {
1 − 0 ≤ ≤


10

Figure 2.2 A triangular waveform

Coefficient a0, using Eq:2.2

1 0 1
= ∫ (1 + ) + ∫ (1 − )
0
− 0

Instead of working through the integrals we shall use

your Casio fx-991ES calculator. Enter the following
keystrokes,
C1aqL$(y(1+Q(X))

RzqLE0$+y(1pJ(X)
)R0EqL$)=









Therefore = −0.57079. For coefficients an, using

Eq:2.3,


11

1 0 1
= ∫ (1 + ) cos( ) + ∫ (1 − ) cos( )

2 − 2 0

In these integrations, replace n by A to calculate the

{aA} values. First set your fx-991ES into it’s radian
mode (q(SETUP)4). We are also going to adjust

the calculation so that a1 =1. The calculator keystrokes
for these integrations are,
C1a4$(y(1+Q(X))k

Q(A)J(X))RzqLE0$+
y(1pJ(X))kJ(A)J(X))R0

EqL$)r


X? = A? 1= = X? = A? 2=








= X? = A? 3= = X? = A? 4=






= X? = A? 5= = X? = A? 6=








12

= X? = A? 7= = X? = A? 8=






= X? = A? 9= = X? = A? 10=







These are the first 10 values of {an} and you will note

that for even values of n, the coefficients are zero. So
we have,


a1 = 1.000
2
a3 = 1/9 = 1/3
2
a5 = 0.04 = 1/25 = 1/5
2
a7 = 0.0204816 = 1/49 = 1/7
2
a9 = 0.01234567 = 1/81 = 1/9


You will notice your calculator takes several seconds
to perform the calculations. You will also find that if

you repeat the exercise to calculate {bn}, all these
coefficients are all zero. This arises because the
triangular wave is an even function – mirror image

about the y-axis.


13

2.3 Creating a Square Wave

To illustrate how a periodic waveform can be
constructed by adding harmonics to a fundamental
frequency we shall consider the square wave. A

sin(2 )
square wave is created by adding together

where n = 1, 3, 5, 7, … as shown in Figure 2.3.



























Figure 2.3 Making a square wave

In Figure 2.3 you can see the fundamental frequency
in the top left. When the third harmonic is added

(weighted by 1/3) you get the waveform in the top
right. Adding the fifth harmonic (weighted by 1/5) you

get the waveform in the middle left. Adding the
seventh harmonic (weighted by 1/7) you get the

14

waveform in the middle right and finally when you add
the ninth harmonic (weighted by 1/9) you get the

waveform as shown in the bottom of the figure.


You will observe as more weighted harmonics are
added together resulting waveform approach that all

a square wave. In effect, a square wave is created by
the superposition of the fundamental frequency
added to be weighted odd harmonics.


2.4 Complex Fourier Series

We need to introduce the complex version of the
Fourier Series in order to appreciate how the Fourier

Transform is derived. Given,

=∞
0 2 2
( ) = + ∑ [ cos ( ) + sin ( )] 2.1


2
=1

Let,

− − + −
sin( ) = and cos( ) = 2.5
2 2

Substitute Eq:2.5 in Eq:2.1,

=∞ 2 − 2 2 − 2
+ −
( ) = 0 + ∑ [ ( ) + ( )]


2 2 2 2.6
=1
15

This becomes,


=∞
0 1 2 2
( ) = + ∑ [( − ) + ( + ) − ] 2.7




2 2
=1


Now introduce,
1
( − ) ≥ 1


2
1
= 0 = 0

2
1 ( + ) ≤ −1
{ 2

The series becomes,
=∞
2 2.8
( ) = ∑

=−∞

The complex coefficients are,
2
= ∫ ( ) − 2.9



These complex coefficients determine the shape of

the waveform x(t). Eq:2.9 is a crucial equation in the
derivation of the Fourier Transform as we shall see in
the next chapter.



16

3 The Fourier Transform

At the end of the last chapter we considered the
complex coefficients {Cn}. If you were to plot |Cn|

against fn you would see something similar to Figure
3.1.
















Figure 3.1 A typical plot of |Cn| against fn.

Now consider what happens when f1 gets a smaller,
the fundamental frequency approaches zero. The
separation of the harmonics gets smaller and we can

say


lim ( ) → ( ) 3.1

→0



→ and Eq:2.9 becomes,



( ) = ∫ ( ) − 2 3.2
−∞


17

This is by no means a rigorous derivation of the
Fourier transform, but does show how the limit of the

coefficient values becomes the spectral function F(f).
f is no longer discrete but continuous from zero

upwards. You will observe that x(t) is normally real
(but not exclusively so), whereas F(f) is complex

where the magnitude spectrum is given by,

2
2
| ( )| = √ [ ( )] + [ ( )] 3.3

and the phase spectrum,

Φ( ) = tan −1 [ [ ( )} ] 3.4
[ ( )]

Very often the angular frequency = 2 is used instead of

f to give,


( ) = ∫ ( ) −
−∞ 3.5

This is the common format for the Fourier Transform
and you will observe that for a perfect Fourier

Transform the integration period is from minus infinity
to plus infinity. Given a signal x(t) which contains

several frequencies, ( ) is used to display all the
frequencies in the form of a spectrum. For example,

Figure 3.2 shows a signal containing three frequency


18

components.













Figure 3.2 A signal containing three frequencies

After the Fourier Transform has been performed on

this signal the result is shown in Figure 3.3.

















Figure 3.3 The spectrum of the signal shown in Figure 3.2
showing the three frequencies.


3.1 Nature of Spectral Lines

Having defined the Fourier Transform we can now
apply it to be single square pulse (also known as a box

function) as shown on the next page. This is defined

19

as,

0 < −
2

( ) = 1 − ≤ ≤
2 2

{ 0 > 2

The Fourier Transform of this function is,


/2
( ) = ∫ 1 − 3.6
− /2


− /2 /2 − − /2
= [ ] = [ ]
− 2 /2
− /2


− −
Using the expression sin( ) = , then
2

sin( /2) 3.7
( ) =
2 /2

Now define the following function,

sin( )
sinc( ) = 3.8



The Fourier Transform of the box function becomes,

20


( ) = sinc( /2) 3.9
2

Figure 3.4 shows a plot of this function,


















Figure 3.4 A plot of a sinc function


This is known as a generalized function where,
sin
lim ( ) = 1
→0

The sinc function has a main central lobe and side

lobes. Something to note, as T gets larger, the sinc
function becomes tighter and narrower. It is now

useful to recognise the box function in the time
domain and its Fourier Transform in the frequency

domain. They are also interchangeable, the box
function in the frequency domain becomes the sinc

function in the time domain.



21





Figure 3.5 the box function and the sinc function are
interchangeable through the Fourier Transform.

We shall now apply the Fourier Transform to a cosine
function where the period of integration is from -T/2
to +T/2. This is the same as applying a box function on

the cosine function as seen in Figure 3.6.
















Figure 3.6 A box function applied to a cosine function.

Performing the Fourier Transform on this function,

/2
( ) = ∫ cos( ) − 3.10

− /2

This can be expressed as,



22

/2 + −


∫ [ ] −
− /2 2

1 /2 1 /2
= ∫ − ( − ) + ∫ − ( + )


2 − /2 2 − /2
Performing the integration,
1 − ( − ) /2 1 − ( + ) /2


( ) = [ ] + [ ]
2 − ( − ) − /2 2 − ( + ) − /2



( − ) /2 − − ( − ) /2 ( + ) /2 − − ( + ) /2
= +
2 ( − ) 2 ( + )



( − ) /2 ( + ) /2


= sin [ ] + sin [ ]
2 ( − ) /2 2 ( + ) /2



Leaving,


( ) = sinc [( − ) ] + sinc [( + ) ] 3.11


2 2 2 2

A plot of this function is shown in Figure 3.7.













Figure 3.7 Fourier Transform of a cosine function

23

You will observe there are now two sinc functions in
the spectrum according to Eq:3.11. These are spectral

lines which are sinc functions at their frequency
positions. Normally you would only consider the
spectrum for positive frequencies.


A couple of points to note, the spectral line is

broadened as a result of performing the Fourier
Transform over a finite interval T. Also, energy has

leaked out of the central lobe into the side lobes. It is
therefore difficult to obtain an accurate measurement

of the magnitude as a result of the spectral leakage.


3.2 Resolving Power

From the observation of the spectral lines in Figure
3.7, you will have noticed a spectral broadening and

sometimes when two spectral lines are close together
they not resolved. Figure 3.8 shows the three stages.









Totally resolved Partially resolved No resolution
Figure 3.8 Three stages of resolving spectral line

24

You may encounter a spectral line which may contain
two or more frequencies however owing to nature of

the Fourier Transform only one spectral line appears.
The problem is even more sever when a much smaller

spectral line is obscured by a much larger spectral line
as seen in Figure 3.9.














Both spectral lines are Only one spectral line is

resolved resolved

Figure 3.9 The effect of a large spectral line on a much
smaller spectral line

To improve the resolving power of the Fourier
Transform you need to maximise the value of T – the

time over which the Transform is performed. This is
only be possible if the signal is stationary. You may

therefore have to sacrifice accuracy in magnitude in
order to resolve much weaker spectral lines.




25

4 How the Fourier Transform Works

You are probably curious as to know how the Fourier
Transform is able to resolve frequency components.

To answer this question, we need to introduce the
concept of orthogonal functions. Two functions are

orthogonal if the following condition is satisfied.


< , > = ∫ ( ) ( ) = 0 4.1


Consider the following functions,

0 ≠
∫ sin( ) sin( ) = { 4.2
− 1 =



∫ cos( ) cos( ) = { 0 ≠ 4.3
− 1 =



∫ sin( ) cos( ) = 0 4.4



These functions are crucial in the understanding of
how the Fourier Transform works. Consider a function
which has two frequency components,


( ) = sin( ) + cos( ) 4.5
2
2
1
1

26

The Fourier Transform of this function is,


( ) = ∫ ( ) cos( ) − ∫ ( ) sin( ) 4.6


Substitute Eq:4.5 into Eq:4.6 will give to four integrals,



( ) = ∫ sin( ) cos( )
1
1
+ ∫ cos( ) cos( )
2
2
− ∫ sin( ) sin( )
1
1
− ∫ cos( ) sin( )
2
2

Looking at these integrals, by Eq:4.4 the first and
fourth integrals are zero. The second integral is finite

when = and the third integral is only finite when
2
= . In effect,
1
∫ ( ) cos( )
2

isolates cos( ) from x(t) and,
2

∫ ( ) sin( )
1

Isolates sin( ) from x(t). All the frequency
1

27

components are filtered out. This is how the Fourier
Transform is able to isolate all the frequency

components in a signal x(t).


4.1 Why does F() need to be Complex?

From the definition of the Fourier Transform, you can
see he how the complex component arises. It should

be remembered a signal x(t) may have several
frequencies with all different phases and having a

complex F() means all these phases are measurable.
Consider the function,

( ) = sin( ) + sin( − ) 4.7
0
0
1
2

A plot of this function when  = 0 is shown in Figure
o
4.1 and a plot of the function when  = 45 is shown
in Figure 4.2.

















Figure 4.1 The function in Eq:4.7 with  = 0

28

You will observe the difference between them – as 

changes so does the appearance of the function.


















Figure 4.2 The function in Eq:4.7 with  = 45 o

The information regarding the phases

is contained within the complex F().
Given a frequency component F(k),

the phase difference is related to the
difference in the sizes of Re[F(k)]

and Im[F(k)] as illustrated in the
diagram on the left. Any vector can be

resolved into two orthogonal components which in
this case are the real and imaginary components. You

can see from this diagram where the phase k arises.
When both the imaginary and real components are

o
the same k = 45 .


29

5 The Discrete Fourier Transform

As it stands the Fourier Transform (Eq:1.2),


1
( ) = ∫ ( ) − 2
0 1.2
is not very useful, however all that changes once you
make a digital equivalent of it. We start by considering

a digitised analogue signal as seen in Figure 5.1.



















Figure 5.1 a sampled signal x(t)

You will observe the duration of the signal is T and N

samples are created after passing this signal through
an analogue to digital converter. The separation of the
samples is △ seconds (the reciprocal of the sampling

frequency). Therefore T = N △. Since the digital
samples are taken from an analogue signal, then,


( ) = ( )| =△ 5.1


30

The complex spectral values are,


( ) → ( ) 5.2


The integral is replaced by a summation sign and

2 → 2 , leaving


= −1
1 2
( ) = ∑ ( ) − 5.3

=0

The dt in the integral cancels with the 1/∆. This is the

Discrete Fourier Transform (DFT) and to perform this
calculation you need multiplications and additions.

You will also notice the presence of the complex
exponential; define the twiddle factor as,


2

= 5.4
















Figure 5.2 Positions of on the unit circle



31

It is not really necessary to include a k in the W as it
can be assumed. To gain an insight into the


significance of consider the unit circle and the

positions occupied by in Figure 5.2.


th
is also called the N roots of unity. You will

observe from Figure 5.2 the values taken on by

for various values of N and k. Evaluating is
necessary in order to perform the DFT, it contains sine

values and cosine values and various approaches are
available. When performing the DFT on a general

purpose microprocessor (useful for non-real-time
applications) you can simply use the features on the

integrated maths coprocessor. In C++ include the
<cmath.h> library. When the program is compiled,

special sine and cosine assembly instructions will
ensure these calculations are passed to the maths
coprocessor for fast calculations.



When using a real-time application, the execution rate
of the DFT needs to be maximised using a digital signal

processor. Some of these processors have their own
sine look-up table. For example, the Motorola
DSP56000 family has a quarter sine wave values in an

embedded look-up table. As you can see from this


32

plot in Figure 5.3 of one cycle of a sine wave, the
sample values for the other three quadrants can be

derived from the first quadrant. Also for the cosine

values you will be aware that cos( ) = sin ( − ).
2


















Figure 5.3 – The shaded area contains sine values


You can therefore determine all the values for
from the embedded look-up table. To use the look-up

2
table, calculate and this value is used as a

2
processor address to give sin ( ). However if a

look-up table is not available you can use the following
algorithms based on truncated polynomial

expansions.


Sine Algorithm:


9
7
3
5
sin( ) = + ∙ + ∙ + ∙ + ∙
3
7
5
9
33

-2
c3 = -0.1666665668 c5 = 0.833302513 10
-5
-3
c7 =-0.198074182 10 c9 =0.2601903036 10

When implementing this algorithm, to maximise the

precision it should be expressed as,


2
2
2
2
sin( ) = (1 + ( + ( + ( + ∙ ))))
9
3
7
5
2
Start with ∙ and work outwards so the calculation
9
becomes a sequence of multiply and adds.
Cosine Algorithm:

9
7
5
3
cos( ) = + ∙ + ∙ + ∙ + ∙
3
5
9
7
where

= − | |
2

The coefficients are the same as in the sine algorithm.


5.1 Four Point DFT

Consider the case of a DFT where there are four input data
values and = − /2 = − . Expanding Eq:5.3,
4

=3
1
( ) = ∑ ( ) 4 5.5
4
=0

34

This becomes

0
1
3
2
4 ( ) = (−1) (0) + (−1) (1) + (−1) (2) + (−1) (3)

which gives,
4 (0) = (0) + (1) + (2) + (3)
4 (1) = (0) − (1) − (2) + (3) 5.6
4 (2) = (0) − (1) + (2) − (3)
4 (3) = (0) + (1) − (2) − (3)


These can be expressed in a matrix format to give,

(0 1 1 1 1 (0)

(1) 1 1 − −1 (1) 5.7
( ) = ( ) ( )
(2) 4 1 −1 1 −1 (2)
(3) 1 −1 − (3)


Eq:5.6 can also be written as,

4 (0) = [ (0) + (2)] + [ (1) + (3)]

4 (1) = [ (0) − (2)] − [ (1) − (3)] 5.8
4 (2) = [ (0) + (2)] − [ (1) + (3)]
4 (3) = [ (0) − (2)] + [ (1) − (3)]

You will observe from Eq:5.8 F(0) is the average of the

data values – the DC value. The significance of Eq:5.8
will be apparent in Chapter 7 on the Fast Fourier
Transform.

35

5.2 Resolution and Frequency Bins

If the initial set of data values have N samples there
will be N/2 positive frequency bins (there is also an
equivalent number of negative frequency bins). The

maximum frequency range of the spectrum will be
half the sampling frequency fs/2. The frequency width

of each frequency bin will be,

/2 = 5.9


/2
This means you should be able to resolve a frequency

components which are separated by fs/N otherwise
they will appear in the same frequency bin. In practice

a frequency component in the signal will spread into
neighbouring frequency

bins for various reasons
as seen in the diagram

on the left.




5.3 Zoom DFT

When you are only interested in part of the spectrum,
there is no need to perform the calculations for all the

spectrum, you can focus on the part of the spectrum
of interest,



36

= −1
1 2
( )| =ℎ↔ = ∑ ( ) − 5.10

=0

This calculation performs for frequency bins k = h to
k = i only. You have effectively zoomed into this part

of the spectrum. Note you still have the same
resolution, to increase the resolution you need to use
sample decimation.




5.4 Tracking
Sometimes the need arises to track the magnitude of

a frequency component over a time period. For
example you may want to watch the movement of the
th
25 frequency bin,

= −1
1 2 25
(25) = ∑ ( ) −
5.11
=0


This equation allows you to watch how F(25) moves
over time You will notice you are only watch one

frequency so the amount of computation is greatly
reduced as the magnitude of only one spectral
component is calculated. Of course you are not limited

to only one frequency, in principle you could track the


37

contents of as
many frequency

bins as is required
as you can see in

the plot on the left
which illustrates

examples of the
tracking of three
frequency bins.



-1
5.5 Log and tan Algorithms
10
Very often the need arises to display the data in a dB

format and you will need to perform the calculation,


2
10 log (| ( )| ) 5.12
10
You will recall the magnitude spectrum is given by,


2
2
2
| ( )| = [ ( )] + [ ( )] 5.13
and the phase spectrum is,
[ ( )]
Φ( ) = tan −1 [ ]
[ ( )]
It’s possible to use an algorithm based on a truncated

polynomial expansion method to find values of log 10 ,
the coefficients,

38

8

log ( ) = + 1 2 + ⋯ ( ) 5.13
8
10
0
2


where = ∙ 2 . The coefficient values for the
expansion are given in the following table.

C0 = -1.332183622 C1 = 4.909769401 C2 = -12.05022337
C3 = 22.36407471 C4 = -28.96563148 C5 =25.42144201
C6 = -14.41930397 C7 = 4.772579384 C8 = -0.7005197015

If you require the phase spectrum, you may elect to

use the algorithm which again uses a truncated
-1
polynomial expansion for tan (x) which is given by,


3
9
−1
tan ( ) = + ∙ + ∙ + ⋯ ∙ 5.14
3
1
9
4
−1
where = . The coefficients are given by,
+1
/4 = 0.785398163 C1 = 0.999866 C3 = -0.3302995
C5 = 0.180141 C7 = -0.085133 C9 = 0.0208351

As you can see from these two algorithms, a lot of
-1
coding is needed to find the log10 and tan values, this
is required for every F(k) value.










39

6 Pre-processing Data

In order to maximise the effectiveness of the Fourier
Transform it is sometimes necessary to discriminate

against the samples at the start and end of the sample
batch. This need arises from the way the Fourier

Transform sees the data. Consider a sine wave as
shown below in Figure 6.1.

















Figure 6.1 A sine wave is sampled over a period T

The integration time for the Fourier Transform is T and

what it effectively sees is shown in Figure 6.2














Figure 6.2 How the Fourier Transform see the input
waveform

40

You will observe the discontinuities at the beginning
and end of the sample period T which will appear as

noise spread across the whole spectrum F(k). An
example is shown in Figure 6.3.















Figure 6.3 The effect of performing a Fourier Transform on data
with a discontinuity at the start and end of the sample batch


6.1 Data Windowing
Data widowing is an effective means of discriminating

against the samples which cause the problems. There
are several window functions which are used,

depending on the nature of the signal. The equation
for creating the well known Hanning window is given

by,


1 2
( ) = [1 − cos ( )] 6.1
2 −1

In figure 6.4 you can see the profile of a Hanning
window multiplied by the data batch in Figure 6.4.



41

Figure 6.4 Hanning window
On
As you can see from the profile, when this window

function is multiplied by the data values, the data
values at the start and end of the batch will be greatly

diminished in value. When a DFT is now performed on
the windowed data the result is shown in Figure 6.5.













Figure 6.5 DFT of the windowed data


You will observe there are in effect two spectral
components that are very close together. Without

data windowing the two spectral components would
not have been partially resolved. You also notice a
reduction in the noise floor across the whole

spectrum as you can see in Figure 6.6.

42

Figure 6.6 Comparison of spectrum with and without the
data windowing.


There are numerous windows available and the choice
will depend on the information required from the
data. These include:

The Hamming window,
2
0.54 − 0.46 cos ( ) 6.2
−1
The Blackman window,
2 4
( ) = 0.42 − 0.5 cos ( ) + 0.08 cos ( ) 6.3
−1 −1

All windows will cause the spectral lines to broaden

and this has the disadvantage of obscuring spectral
lines which of very close together if not used properly.

As a general point, if the signal is contaminated with
noise it’s not customary to apply a window to the

input data.




43

7 The Fast Fourier Transform

During the 1960s it was realised by James Cooley and
John Tukey the calculation of the Discrete Fourier

Transform could be speeded up. This arises from
removing repetitive calculations within the DFT.

Looking at the DFT,

= −1

( ) = ∑ ( ) 7.1
=0

The number of calculations required to perform this

2
2
operation is O(2N ) – of the order 2N . The Fast
Fourier Transform (FFT) reduces this to O(N log 2N).
The first stage of the FFT is to partition the data values
into even values and odd values to give,


( ) = (2 ) and ( ) = (2 + 1)
1
2

The Fourier Transform becomes,

= −1 = −1
2 2
( ) = ∑ (2 ) 2 + ∑ (2 + 1) (2 +1) 7.2
=0 =0

The first summation can be written as,





44


Click to View FlipBook Version