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


= −1
2
7.3
2
∑ ( )
1
=0

And the second summations can be written as,


= −1 = −1
2 2 7.4

∑ (2 + 1) (2 +1) = ∑ ( ) 2
2
=0 =0
Now let

= −1
2
( ) = ∑ ( ) 2 7.5
1
1
=0
and

= −1
2
7.6

( ) = ∑ ( )
2
2
=0

The Fourier Transform becomes,



( ) = ( ) + ( ) 7.7
2
1



where the k values go from = 0, 1, … − 1.
2
However ( ) and ( ) are periodic, therefore for
1
2

45


= , + 1, … , leading to,
2 2

7.8

( + ) = ( ) − ( )
2

1
2

The – sign in Eq:7.8 arises from,

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



+
In general = . To calculate ( ) you need
1

2
to perform 2( /2) calculations. Likewise to calculate
2
( ) you also need to perform 2( /2) calculations.
2
To calculate ( ) you need to perform,

2 2
2
2 ( ) + 2 ( ) = 7.10
2 2

The number of calculations has been reduced from
2
2
2 to . You now partition ( ) and ( ) into
2
1
odd and even values and perform the same process.
You keep performing this until you end up with only
two samples left in each final set.


The number of stages you have to pass through until
you reach 2 samples in the final sets is log 2(N).





46

7.1 8-Point FFT

Consider the equation,
=7

( ) = ∑ ( ) 7.11
=0

(we shall ignore 1/8 for the moment). When Eq:7.11

is expanded we get,


3
( ) = (0) 8 0 + (1) 8 1 + (2) 8 2 + (3)
8
7
+ (4) 8 4 + (5) 8 5 + (6) 8 6 + (7)
8

Partition into even and odd values,

6
(0) + (2) 8 2 + (4) 8 4 + (6)
8

7
(1) 8 1 + (3) 8 3 + (5) 8 5 + (7)
8

Note,
2 2 2


8 2 = 8 = − 4 =
4

2 4 2 2
2
8 4 = − 8 = − 4 =
4

2 6 2 3

3
8 6 = 8 = − 4 =
4

Therefore for the even values,

47

3

(0) + (2) + (4) 4 2 + (6)
4
4

Also note
2



8 3 = 8 (2+1) = =
8
4
8
8



2
4
8 5 = 8 (4+1) = =
4
8
8
8

3


6
8 7 = 8 (6+1) = =
8
8
8
4

Therefore for the odd values,



3



2
(1) + (3) + (5) + (7)
8
4
8
8
8
4
4


3

= [ (1) + (3) + (5) 4 2 + (7) ]
4
8
4

Let

3
( ) = (0) + (2) + (4) 4 2 + (6)
1
4
4
and
3

( ) = (1) + (3) + (5) 4 2 + (7)
4
4
2
leaving

( ) = ( ) + ( )
1
2
8

Further partition ( ) and ( ),
1
2

3
2

(0) + (4) (2) + (6)
4
4
4

3
2
(1) + (5) (3) + (7)
4
4
4
48

Note,
2 2 2

4 2 = − 4 = − 2 =
2

2 3 2 (2+1) 2 2


4 3 = − 4 = − 4 = − 2 − 4 =
4
2

Leaving,

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






(2) + (6) = [ (2) + (6) ]
4
2
4
2
4
Let,

( ) = (2) + (6)
4
2


( ) = (1) + (5)
2
5






(3) + (7) = [ (3) + (7) ]
4
2
4
2
4
Let,

( ) = (3) + (7)
2
6

Leaving,

( ) = ( ) + ( )
4
1
3
4
and

( ) = ( ) + ( )
2
6
5
4

Now consider Eq:7.5 and Eq:7.6 for the k values.


49

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

0
0
(0) = (1) + (5) (0) = (3) + (7)
2
6
5
2
1
1
(1) = (1) − (5) (1) = (3) − (7)
2
5
6
2


Stage 2
0
0
(0) = (0) + (0) (0) = (0) + (0)
4
2
4
6
3
5
4
1
1
1
(1) = (1) − (1) (1) = (1) − (1)
5
1
4
4
2
3
6
4
2
2
(2) = (0) + (0) (2) = (0) + (0)
2
4
6
5
4
3
1
4
3
3
(3) = (1) − (1) (3) = (1) − (1)
2
1
4
6
3
5
4
4


Stage 3
0
4
(0) = (0) + (0) (4) = (0) + (0)
1
2
1
2
8
8
1
5
(1) = (1) − (1) (5) = (1) − (1)
2
2
1
1
8
8
2
6
(2) = (2) + (2) (6) = (2) + (2)
1
1
8
2
2
8
7
3
(3) = (3) − (3) (7) = (3) − (3)
2
1
2
8
1
8

With the equations in three stages, we can now
construct what is know as a Butterfly Diagram which
you can see on the next page. You will observe the
input data has been re-arranged and this referred to
as decimation in time. Also indicated on the Butterfly
Diagram are W values, either positive (green) or
50

negative (yellow).





































Figure 7.1 Butterfly Diagram for an 8-point FFT


Should you be wondering where the log 2 arises,
referring to Figure 7.1 you will observe there are 8

data values and 3 stages in the calculation; log (8) =
2
3
log (2 ) = 3 log (2) = 3. This is called the radix-2
2
2
algorithm and it requires the number of data values to
n
be 2 which n can be any positive integer. You will
observe the number of W values can be simplified to

51

reduce the number of calculations.

7.2 Bit Reversal

One of the problems with the FFT is the positioning of
the spectral values F(k) – they end up in the wrong

addresses. In the 8-point example, the input data was
re-arranged to avoid this problem. If you perform an

FFT on eight samples for example, the spectral values
end up in the following order.
















Figure 7.2 The spectral data arrives at the wrong addresses

In order to get them in the right order you can use a
bit-reversal method which is reversing the binary
addresses of the spectral values locations. The new

addresses are created by reversing the binary values
as illustrated in Figure 7.3 on the next page. This can

n
be extended to any value of 2 and is usually a routine
attached to the end of the FFT algorithm.


52

Figure 7.3 Reversing the binary bit positions gives the correct
location for the spectral data.


7.3 Improvement in Execution Time

The number of calculations needed to perform the FFT
is ∙ log ( ). This algorithm is referred to as the
2
radix-2 algorithm and can arrive at F(k) with far fewer
calculations than the DFT as shown in Figure 7.4. Not
only is the FFT faster than the DFT but it is more

accurate for the simple reason it performs fewer
calculations to arrive at the spectrum F(k). The table

on the following page gives an indication of the
general improvement of the FFT over the DFT.


Figure 7.4 This shows
the reduction in the
number of calculation
when using the FFT
instead of the DFT.


53

DFT FFT Improvement
2
N log ( ) 4 2 log ( )
2
2
4 2 64 16 4
8 3 256 48 5
512 9 1,048,576 9,216 114
1024 10 4,194,304 20,480 205
2048 11 16,777,216 45,056 372

You can appreciate from this table the improvement

in execution rate of the FFT. Many applications only
require the FFT of 1024 data points and this has

become a standard by which to measure the
execution rate of hardware. On today’s digital signal
processors you would expect the execution time of a

1024 FFT to be a few hundred microseconds or less.


7.4 Definitions

When reading about the FFT you will come across a
number of definitions which are often used in the

context of FFT only. Here are some of them.

Decimation in Frequency: when the spectral data has

to be rearranged using bit-reversal to get it in the right
order. This occurs when the input data is not

partitioned into odd and even values.


Decimation in Time: partitioning the data into off and


54

even values before performing the FFT. The spectral
values will then arrive in the right order.


Zero padding: very often you may have a number of
n
input data values which is not equal to N = 2 . When
n
this happens you make up to the nearest N = 2 value
by adding zeros into the data stream. There will N/2
spectral bins and the FFT effectively interpolates to
give values into the additional spectral bins. Note, no

new information is produced by the interpolation.


Radix-4 and Radix-8: these are FFT algorithms where
the final number of data values is 4 and 8 in each

group as opposed to the Radix-2 algorithm which we
have looking at in this chapter.


Inverse FFT: As in the DFT, the FFT process can be
reversed to recover the original input data x(t). It will

be interesting to note for audio compression such as
MP3, the music data in actually stored in the

frequency data and during playback an inverse DFT
needs to performed in real-time.


In-place Algorithm: When the FFT was first

implemented in the 1960s memory was small and

55

costly. Efficient use had to be made of it and was the
case when using the FFT. You will observe the various

stages in the FFT in Figure 7.1. in the in-place
algorithm, the newly calculated intermediate data

was placed in the same memory locations as the
original input data. This means, the final spectral data

would be located in the same memory locations as the
original data. Needless to say this is no longer
necessary as memory is cheaper and bigger.





• You will find the FFT coded in

C++ in the C++ Cookbook by
Cogswell, Turkanis, Diggins and

Stephens published by O’Reilly
Safari ISBN: 9780596007614


https://www.oreilly.com/library/view/c-
cookbook/0596007612/ch11s18.html









56

8 Commercial FFT Analysers

During the 1990s many FFT analysers appeared on the
market – far more than the market could support and

consequently many of them ceased to be
manufactured. One spectrum analyser (which ceased

production in 2018) is the Keysight Technologies
35670A dynamic Signal Analyser originally made by

Hewlett Packard (HP) as shown in Figure 8.1.

























Figure 8.1 The 35670A FFT Spectrum Analyser

A remarkable instrument with a maximum of 4 input

channels as you can see in Figure 8.1. Ideal for small
scale vibration measurements, it is able to perform a

huge number of tasks and could analyse signals
containing frequencies up to 120 kHz. Another FFT

57

spectrum analyser is from Lambda, the SR760 as
shown in the image below.

















Figure 8.2 The Lambda SR760 FFT Spectrum Analyzer


This instrument will measure frequencies up to 100
kHz and has a 90dB dynamic range. It also performs

linear and exponential averaging and has an
antiquated floppy-disc drive.


However there has been a move away from this type

of instrumentation towards
systems where huge numbers
of signals can be analysed

simultaneously. One example
is the range of devices

manufactured by ZETLAB. For
example the ZET 017-U32 as

shown on the left. It has a
58

frequency range to 20 kHz and a dynamic range of 110
dB. Idea for vibration and acoustic analysis as the

accompanying software is able to perform an
impressive range of signal processing tasks.

The theme of systems for signal measurements has
been adopted by National Instruments who

manufacture a very impressive range of
instrumentation for signal analysis, processing and

control. They have adopted a modular approach
where a customer specifies their individual needs and

a system is tailored to their needs.

















Figure 8.3 National Instruments products

The National Instruments products works in
conjunction with LabView software where the FFT is

one of many functions that can be performed on this
extensive instrumentation.



59

9 Running Fourier Transform

Having looked at the Fast Fourier Transform, we can
focus our attention on Running Fourier Transform

(RFT). It has a number of interesting applications, for
example real-time multi-bandpass digital filtering.


When provided with a batch of digital samples,

applying the FFT gives the complex spectral set. If
there are N data samples in the original data set, you

are required to perform, of the order of, N.log2(N)
calculations when using the FFT.


Given a second set of N data samples you would be
expected to perform another N.log2(N) calculations.

What if you had a continual stream of data samples
and you wanted to calculate a new spectrum every

time a new sample arrives, would you have to perform
N.log2(N) calculations each time? By using the RFT this

is not necessary, in fact the number of calculations is
greatly reduced.


9.1 Deriving the RFT

th
Consider a data stream of samples, the m spectrum
can be expressed as,


60

= +
1 2 ( − )
( ) = ∑ ( ) − 9.1


=

After the next sample arrives, the new DFT is given by,


= +
1 − 2 ( − −1)
+1 ( ) = ∑ ( ) 9.2

=

When Eq:9.2 is extended to include the sample n = m,
we get
= +
1 2 ( − −1) 2
+1 ( ) = { ∑ [ ( ) − ] − ( ) }
9.3
=

Now remove the last term from the sum which

involves x(N+m) to give,

= + −1
2 ( − −1) 2 2
∑ [ ( ) − ] − ( ) + ( + )
=

The transform can be written as,
= + −1
2 1 2 ( − −1)
+1 ( ) = { ∑ [ ( ) − ]
9.4
=
1
+ [ ( + ) − ( )]}


61

We can now insert Eq:9.1 into Eq:9.4 to give,


2 ( + ) − ( )
+1 ( ) = { ( ) + } 9.5



This equation is the Running Fourier Transform.



9.2 Using the RFT

What does Eq:9.5 tell you, if you have calculated the
th

th
m spectra, the (m + 1) spectra, after the arrival of
the new sample x(N+m) can be derived from the
previous spectrum. You will recognise that where k is
the frequency index, (k = 0,1, 2, ... N/2 - 1). As you can

see from this expression once you have calculated the
first spectrum {Fo(k)} successive spectra are calculated

recursively.


The spectrum {Fm(k)} has N/2 complex values, but in
its application you may only be interested in a
behaviour of the spectrum at particular frequencies,

therefore you only need to calculate the spectral
values of interest. As you can see from Eq:9.5, we

need to remove the oldest data point x(m) and add

62

the newest data point x(N+m), we therefore have to
store all the data points (N) in the current batch. This

is best achieved by using a circular buffer, which will
be discussed later.


To illustrate how the RFT can be used, let us consider

an example. A signal is being sampled at 20 kHz
(sample period of 50 μsec) and new spectral values
are required for every new sample produced. But let's

say that we are only interested in the frequency
components at 3.35 kHz, 4.050 kHz and 6.650 kHz. If

there are 200 real data samples in a batch (N=200),
the spectrum will comprise 100 unique complex

values. The time over which the samples are collected
will be 200 x 50μsec = 10 msec.


The spectral resolution for each k value will be
1/10msec = 100 Hz. The integer value of the index k

for the above frequencies will therefore be,
3350 4050 6650
≈ 33, ≈ 40, ≈ 66
100 100 100

Out of the 100 values in the spectral set we would only
calculate

{Fm(33), Fm(40), Fm(66)}.
Since 1/200 = 0.005, by using Eq:9.5, these become,

63

+1 (33) = 1.036 { (33) + 0.005[ − ]}


+1 (40) = 1.256 { (40) + 0.005[ − ]}


+1 (66) = 2.073 { (66) + 0.005[ − ]}


Initially the buffer will be empty, but as you keep

adding data values the spectrum will develop. In
principles you can extend this argument for as many

frequency components as you want. It's also worth
noting that since the spectral values are complex they

carry magnitude and phase information.


Alternatively, since they are quadrature pairs (a sine
and cosine) each Fm(k) may carry two channels of
information. The RFT is in effect only allowing the

required frequencies. In this example it's operating
like a bandpass filter where the three spectral

components are be fed into separate channels.



9.3 The Data Buffer

You will observe from Eq:9.5 you will require a buffer
to store the N samples. As each new sample comes




64

into the buffer the oldest sample is ejected as
illustrated in Figure 9.1











Figure 9.1 The data buffer

As you can see in Figure 9.1, the newest sample is
stored in the buffer and the samples have to be moved

along. The oldest sample drops out of the buffer.

Configuring the data buffer as a set of shift registers is

very inefficient. The best way of storing N data values
is to use a circular buffer where the newest data value

replaces the oldest data value. Figure 9.1 illustrates
how a circular buffer operates, x(n) is the oldest

sample and x(n+6) is the most recent.


The key aspect of a circular buffer is the address
mechanism which is derived from a prime number.
The counter, in this example, counts from 0 to 6 and

repeats and acts as an address generator.






65

Figure 9.2

The addressing mode of the circular buffer, with 8
addresses and an address counter which goes from 0
to 6. The end of the count always falls on the oldest

data location. The newest data values goes in
address 0 which moves in an anticlockwise direction.


When there are seven addresses and the counter

expires, it automatically points to the oldest address
where the newest data sample x(n+7) will be stored

(when the address counter = 0). In this example the
counter is generated by using,
(n+7) mod 7

which is defined as the remainder integer after (n+7)
66

has been divided by 7 which gives 7 different address
numbers before the repeat begins. In order for this to

work the divisor must be a prime number.


In the above discussion no mention has been made of
possible round off effects. Eq:9.5 is recursive (new

values derived from old values). Consideration needs
to be made to ensure RFT retains maximum accuracy.
One possible solution is to perform a DFT for every

few hundred thousand data samples and use a
floating point processor (FPP). Several FPPs have sine

look-up tables and a circular addressing modes.






This completes this flipbook on the
Fourier Transform and I hope you have

gained an understanding of what the
Transform is all about and how it can

benefit you in your understanding of
your subject.






67

Other flipbooks from Cambridge Paperbacks






















































68

www.CambridgePaperbacks.com



































69


Click to View FlipBook Version