You are on page 1of 40

SIGNAL PROCESSING & SIMULATION NEWSLETTER

Fourier analysis made Easy Part 1

Jean Baptiste Joseph, Baron de Fourier, 1768 - 1830

While studying heat conduction in materials, Baron Fourier (a title given to him by
Napoleon) developed his now famous Fourier series, approximately 120 years after
Newton published the first book on calculus. It took Fourier another twenty years to
develop the Fourier transform which made the theory applicable to a variety of
disciplines such as signal processing where Fourier analysis is now an essential tool.
Fourier did little to develop the concept further and most of that work was done by
Euler, LaGrange, Laplace and others. Fourier analysis is now also used in thermal
analysis, image processing, quantum mechanics and physics.

Why do we need to do Fourier analysis – In communications, we can state the


problem at hand this way; we send an information-laced signal over a medium. The
medium and the hardware corrupt this signal. The receiver has to figure out from the
received signal which part of the corrupted received signal is the information signal and
which part the extraneous noise and distortion. The transmitted signals have well
defined spectral content, so if the receiver can do a spectral analysis of the received
signal then it can extract the information. This is what Fourier analysis allows us to do.
Fourier analysis can look at an unknown signal and do an equivalent of a chemical
analysis, identifying the various frequencies and their relative “quantities” in the signal.

Fourier noticed that you can create some really complicated looking waves by just
summing up simple sine and cosine waves. For example, the wave in Figure 1a is sum
of the just three sine waves shown in Figures 1b, 1c and 1d of assorted frequencies and
amplitudes.

Easy Fourier Analysis Part 1 Complextoreal.com 1


(a) - A complicated looking wave

(b) - Sine wave 1 (c)- Sine wave 2 (d) - Sine wave 3

Figure 1 - Sine waves

Let’s look at signal 1a in three dimensions. With time progressing to the right we
see the amplitude going up and down erratically, we are looking at the signal in Time
domain. From this angle, we see the sum of the three sine waves as shown in Fig
(1b,c,d).

When we look at the same signal from the side along the z-axis, what we see are the
three sine waves of different frequencies. We also see the amplitude but only as a line
with its maximum excursion. This view of the signal from this point of view is called
the Frequency Domain. Another name for it is the Signal Spectrum.

Figure 3 - Looking at signals from two different points of view

The concept of spectrum came about from the realization that any arbitrary wave is
really a summation of many different frequencies. The spectrum of the composite wave
f(t) of Fig (1) is composed of just three frequencies and can be drawn as in Fig (3.1).

Easy Fourier Analysis Part 1 Complextoreal.com 2


This is called a one-sided magnitude spectrum. One-sided not because anything
has been left out of it, but because only positive frequencies are represented. (So what
is a negative frequency? Is there such a thing? We will discuss this in more detail in
later. For now, suffice it to say that a negative frequency is simply a frequency which is
lagging in phase.)

Figure 3.1 - The Frequency Domain spectrum of wave in Figure 1

Now let’s look at the signal in frequency domain. Think of it as a recipe, with x-
axis showing the ingredient and the y-axis, how much of that ingredients. The x-axis
for a signal would show the different frequencies in the signal and y-axis the amplitude
of each of those frequencies.

Let’s expand on this concept. V-8 juice for example has many different ingredients
such as celery juice, salt, water, spices, etc.. We can remove most of these ingredients
one by one and the remaining liquid would still taste essentially like V-8. What we can
not remove and have the item still retain its primary character is called the
fundamental component. In V-8, that is tomato juice.

Signals carrying information, similarly, have a fundamental frequency along with


other lesser important frequencies. A noisy signal on the other has no single
fundamental frequency. It has a flat spectrum. All frequencies are present in the signal
in the same quantities. So a spectrum does not necessarily have a fundamental
component. The spectrum of such a signal would be flat.

Let’s take the following complicated looking wave.

Easy Fourier Analysis Part 1 Complextoreal.com 3


This wave is periodic with
a period = 1 sec.

Figure 4 - Another really complicated looking wave

The first thing we notice is that the wave is periodic. Fourier analysis tells us that
any arbitrary wave such as the above that is periodic, can be represented by a sum of
other simpler waves.

Let’s try summing a bunch of sine waves to see what they look like.

Figure 5a - This is a wave of frequency 1 Hz , amplitude = 1

Figure 5b - This is a wave of frequency 2 Hz , amplitude = 1

Figure 5c - This is a wave of frequency 3 Hz , amplitude = 1

Easy Fourier Analysis Part 1 Complextoreal.com 4


Figure 5d - This is a wave of frequency 4 Hz , amplitude = 1

Each of the waves here have frequencies that are integer multiples. In more
scientific words, we say that they are harmonic to each other, similar to musical notes
which are also called harmonic.

• What is a harmonic – It is a frequency that is integer multiple of the other


frequency. Waves of frequency 2 and 4 Hz are harmonics to a wave of frequency 1 Hz
since they are both its integer multiples. Frequencies 2.4 and 3.6 Hz are harmonics to a
wave of frequency 1.2 Hz since they are both integer multiples of 1.2 Hz.
• When the multiple factor is even, the harmonic is called an even
harmonic and when the factor is odd, it is called the odd harmonic.
• Frequencies 66, 110, 154 Hz are odd harmonics of frequency 22 Hz,
whereas 44, 88 and 132 Hz are even harmonics.

We write the sum of N such harmonics as

N
f (t ) = ∑ sin(n ω t ) (1)
n =1

Each wave has a frequency that is integer multiple of the starting frequency ω,
which is equal to 2π (1) in this case since f = 1 Hz. Here is what a sum of four sine
waves of equal amplitude, each starting with a phase of 0 degrees at time 0 looks like.

f (t ) = sin(1ω t ) + sin(2ω t ) + sin(3ω t ) + sin(4ω t )

Figure 6 - This is the sum of all four of the above sine waves.

Easy Fourier Analysis Part 1 Complextoreal.com 5


If we keep going and add a large number of sine waves of equal amplitude, the
summation approaches an impulse function as shown below for N = 25. Since we
added together 30 sine waves of amplitude 1, the maximum amplitude is 25.

Figure 7 - This is the sum of 25 sine waves.

In the graph above, we allowed the amplitude of each harmonic to be one. Going to
the next level of abstraction, it is obvious that to represent an arbitrary wave, we need
to allow the amplitude of each component to vary. Otherwise, all we will get is the
scaled version of the signal in Fig (7). So we modify equation (1) by introducing a
coefficient an to represent the amplitude of the nth sine wave as follows:

N
f (t ) = ∑ an sin(n ω t ) (2)
n =1

The coefficient an allows us to vary the amplitude of each harmonic fn(t) = sin(nωt)
to create a variety of waves. Here is what one particular wave which is the sum of four
sine waves of unequal amplitude looks like.

Figure 8 - Sum of four sine waves of unequal amplitude

But looking at the original wave, f(t) in Fig (4), we see that it starts at a non-zero
value. No matter how many sine waves we add together, we can not replicate this wave
because sine waves are always zero at time zero. But if we add some cosine waves to
the sum in equation (2) which do not start at zero, we may be able to create the wave of
Figure 2.

Easy Fourier Analysis Part 1 Complextoreal.com 6


So let’s add a bunch of cosine waves of varying amplitudes to our f(t) equation.

Figure 9a - A cosine wave of frequency 1 Hz, amplitude = 1

Figure 9b - A cosine wave of frequency 2 Hz, amplitude = 1

Figure 9c - A cosine wave of frequency 3 Hz, amplitude = 1

Figure 9d - A cosine wave of frequency 4 Hz, amplitude = 1

Once again the sum of the cosine waves of equal amplitude looks like this.

Easy Fourier Analysis Part 1 Complextoreal.com 7


Figure 10 - Sum of four cosine waves of equal amplitude

Figure 11 - Sum of 30 cosine waves of equal amplitude

A sum of 30 cosine waves looks like as in Fig (11). It approaches an impulse


function just as the sum of sine waves did but this one is an even function.

• Even function – The function that is symmetrical about the y-axis. Cosine wave
is an even function.
• Odd function – The function that is not symmetrical about the y-axis. Sine wave
is an odd function.

The sum of the cosines is an even function. Contrast this with Fig (7), the sum of
sines, which is an odd function. These characteristics, odd and even, are useful when
looking at real and imaginary components of signals.

Now let’s allow the amplitude of each cosine wave to vary. Here is what one
particular sum of four cosines of unequal amplitudes looks like.

Figure 12 - Sum of four cosine waves of unequal amplitude.

Now let’s modify equation (2) to add the cosine waves.

Easy Fourier Analysis Part 1 Complextoreal.com 8


N N
f (t ) = ∑ an sin(n ω t ) + ∑ bn cos(n ω t ) (3)
n =1 n =1

The coefficients bn allow us to vary the amplitude of each cosine wave. Putting this
equation to work, we see in the following figure the sum of four sine and four cosine
waves.

Figure 13 - Sum of five sine and cosine waves of unequal amplitudes

We are very close to completing our equation for arbitrary periodic waves. There is
only one remaining issue. Sums of sine and cosines are always symmetrical about the
x-axis so there is no possibility of representing a wave with a dc offset. To do that we
add a constant, a0 to the equation. This constant moves the whole wave up (or down)
along the y-axis offset.

N N
f (t ) = a0 + ∑ an sin(nω t ) + ∑ bn cos(nω t ) (4)
n =1 n =1

The coefficient a0 provides us with the needed dc offset from zero. Now with this
equation we can fully describe any periodic wave, no matter how complicated looking
it is. All arbitrary but periodic waves are composed of just plain and ordinary sines and
cosines and can de composed in its constituent frequencies..

Equation (4) is called the Fourier Series equation. The coefficients a0, an, and
bn are called the Fourier Series Coefficients.

An equation with many faces

There are several different ways to write the Fourier series. One common
representation is by linear frequency instead of the radial frequency. Replace ω by 2πf
and then write the equation as

N N
f (t ) = a0 + ∑ an sin( 2π nft ) + ∑ bn cos(2π nft ) (5)
n =1 n =1

Easy Fourier Analysis Part 1 Complextoreal.com 9


The Fourier series equation allows us to represent any wave, low or high frequency,
baseband or passband, large bandwidth or very small. N is the number of harmonics
used in the summation. This is a variable and we can choose it to be anything, but for
complete representation, N is set to infinity. This makes the equation completely
general and we can represent even noise signals this way. The harmonics themselves do
not have to be of integer frequencies such 1, 2, 3 etc.. The starting frequency can be any
real or imaginary number. However, the harmonics of the starting frequency ARE its
integer multiples.

1
f n (t ) = n f (t ) = n
T

f(t) the smallest frequency is called the resolution frequency, determines how
finely we decompose the signal. It can be any arbitrary number, say for example 2.35.
From that point on, the next harmonic is 2 times this, next one 3 times and so on. T, is
the period of the first wave we pick, and each fn is an integer multiple of the inverse of
that period. We can also start anywhere. We can pick a small resolution frequency and
then start the analysis with the 100th harmonic for example.

Replace fn by n/T, where T is the period and replace N by ∞ to write equation (5)
in a different from.


f (t ) = a0 + ∑ an sin ( 2π t n / T ) + bn cos ( 2π tn / T ) (6)
n =1

We can also convert all sine waves and make them cosine waves by adding a half-
period phase shift. The cosine representation, used often in signal processing is written
by adding a phase term to the equation.

sin(2π ft ) = cos(2π ft + π / 2)

To create the f(t) we would add two cosine waves of the same frequency, except the
one of them would have a π / 2 phase shift (that’s a sine wave, really.) Now we have
only cosines. The name of the coefficient has been changed to cn, to reduce confusion
between this term and the terms an and bn. a0 and C0 would be exactly the same as a0.

f (t ) = C0 + ∑ Cn cos(2π f n t + φn )
n =1

f (t ) = C0 + ∑ Cn cos( wn t + φn )
n =1
(6a)

2π n
f (t ) = C0 + ∑ Cn cos( t + φn )
n =1 T

Easy Fourier Analysis Part 1 Complextoreal.com 10


In complex representation, the Fourier equation is written as


f (t ) = ∑
n =−∞
Cn e jnπ t / T (7)

Complex notation, first given by Euler, is most useful-albeit scary-looking form. In


next part, we look at how it is derived and used for signal processing.

All these different representations of the Fourier Series (4), (5), (6), (6a) and (7) are
identical and mean exactly the same thing.

How to compute the Fourier Coefficients of an arbitrary wave

In signal processing, we are interested in spectral components of a signal. We want


to know how many sines and cosines make up our signal and what their amplitudes are.
Alternatively, what we really want are the Fourier coefficients of our signal. Once we
know the Fourier coefficients, we know which frequencies are present in the signal and
in what quantities. This is similar to doing chemical analysis on a compound, figuring
out what elements are there and what relative quantity.

How do we compute the Fourier coefficients?

Computing a0


f (t ) = a0 + ∑ (an sin ωnt + bn cos ωn t )
n =1

The constant a0 in the Fourier equation above represents the dc offset. But before
we compute it, let’s take a look at one particular property of the sine and cosine waves.

Both sine and cosine wave are symmetrical about the x-axis. When you integrate a
sine or a cosine wave over one period, you will always get zero. The areas above the x-
axis cancels out the areas below it. This is always true over one period as we can see in
the figure below.
Positive and
negative area Positive and
cancel. negative area
cancel. +Area
+Area
+Area

-Area
-Area

Figure 14 - The area under a sine or a cosine wave over one period is always zero.

Easy Fourier Analysis Part 1 Complextoreal.com 11


 ∞ 
∫o  ∑
T
an sin wn t  dt = 0
n =1 
T ∞

∫o  ∑
n =1
an sin wn t + bn cos wn t  dt = 0

The same is also true of the sum of sine and cosines. Any wave made up of sum of
the sine and cosine waves also has zero area over one period. So we see that if we were
to integrate our signal over one period the area obtained will have to come from
coefficient a0 only. The harmonics can make no contribution and they fall out.
0
644444 4744444 48
T
T ∞

f (t )dt = ∫ ao dt + ∫  ∑ an sin wn t + bn cos wnt  dt
T

0
0 o
 n =1 
(8)

The second term is zero in (8), since it is just the integral of a wave made up of sine
and cosines. Now we can compute a0 by taking the integral of our complicated looking
wave over one period.

The wave has non-zero area


in one period, which means it
has a DC offset.

Figure 16 - Signal to be analyzed, looks like it has a dc offset since there is more area
above the x-axis than below.

All area comes from the a0


coefficient.

Figure 16a - The dc component

Easy Fourier Analysis Part 1 Complextoreal.com 12


Area under the wave when
shifted down is zero.

Figure 16b - Signal without the dc component

The area under one period of this wave is equal to


T T


0
f (t )dt = ∫ ao dt
0
(9)

Integrating this very simple equation we get,


T

∫ f (t )dt = a T
0
0 (10)

We can now write a very easy equation for computing a0


T
1
a0 =
T ∫ f (t )dt
0
(11)

Since no harmonics contribute to area, we see that a0 is equal to simply the area
under our complicated wave for one period divided by T, the integral period. We can
compute this area in software and if it is zero, then there is no dc offset. This is also the
mean value of the signal. A signal with zero mean value has no dc offset.

Computing an

Now we employ a slightly different trick from basic trigonometry to compute the
coefficients of the sine waves. Here is a sine wave of an arbitrary frequency nω that has
been multiplied by itself.

f (t ) = sin n ω t *sin n ω t

Easy Fourier Analysis Part 1 Complextoreal.com 13


Figure 17 - The area under a sine wave multiplied by itself is always non-zero.

We notice that the resulting wave lies entirely above the x-axis and has a net
positive area. From integral tables we can compute the area as equal to

T
(12)
∫ an ( sin nωt ) ( sin mωt ) dt = anT / 2
0
for n = m

Where T is the period of the fundamental harmonic. But now let’s multiply the sine
wave by an arbitrary harmonic of itself to see what happens to the area.

f (t ) = sin n ω t *sin m ω t
Sine wave multiplied by
another of a different
harmonic

Multiplying one sine wave by


any other causes the area
under the new wave to
become zero.

Figure 18 - The area under a sine wave multiplied by its own harmonic is always zero.

The area in one period of a sine wave multiplied by its own harmonic is zero. We
conclude that when we multiply a signal by a particular harmonic, the only contribution
comes from that particular harmonic. All others harmonics contribute nothing and fall
out.

Easy Fourier Analysis Part 1 Complextoreal.com 14


T

∫ a ( sin nωt ) ( sin mωt ) dt = 0


0
n for n ≠ m

(12)
T

∫ a ( sin nωt ) ( sin mωt ) dt = a T / 2


0
n n for n = m

Now let’s multiply a sine wave by a cosine wave to see what happens.

f (t ) = sin nω t *cos mω t
Sine wave multiplied by a
cosine wave for any n and m

Figure 19 - The area under a cosine wave multiplied by a sine wave is always zero.

It seems that the area under the wave which is multiplication of a sine and cosine
wave is always zero whether the harmonics are the same or not. Summarizing, by
setting ωn = nω

∫ a ( sin ω t ) ( sin ω t ) dt = 0
0
n n m for n ≠ m

∫ a ( sin ω t ) ( sin ω t ) dt = a T / 2
0
n n m n for n = m (13)

∫ a ( cos ω t ) ( sin ω t ) dt = 0
0
n n m for all n and m

Rules:

1. The area under one period of a sine or a cosine is zero.

2. The area under one period of a wave that is a product of two sine or cosine
waves of non-harmonic frequencies is zero.

Easy Fourier Analysis Part 1 Complextoreal.com 15


3. The area under one period of a wave that is a product of two sine or cosine
waves of same harmonic frequency is non-zero and not equal to anT / 2 , where
T is the period of the resolution frequency we have chosen.

4. The area under one period of a wave that is a product of a sine wave and a
cosine wave of any frequencies (different or equal) is equal to zero.

Recall that in vector representation, sine and cosines are orthogonal to each other.
So all harmonics are by definition orthogonal to each other.

A very satisfying interpretation of the above rules is that sine and cosine waves can
act as filtering signals. In essence they act as narrow-band filters and take out all
frequencies except the one of interest. This forms the basic concept of a filter.

Now let’s use this information. Successively multiply the Fourier equation by a sine
wave of a particular harmonic and integrate over one period as in equation below.

0 0
644744
8 64444744448
T T T T

∫ f (t ) sin ( nwt ) dt = ∫ a0 sin ( wt ) dt + ∫ an sin ( nω t ) sin ( nω t ) dt + ∫ bn cos ( nω t ) sin ( nω t ) dt


o 0 0 0

We know that the integral of the first and the third term is zero since the first term
is the integral of a sine wave multiplied by a constant (Rule 1) and the third is a sine
wave multiplied by a cosine wave (Rule 3). This simplifies our equation considerably.
The integral of the second term is
T
anT
∫a n sin ( nω t ) sin ( nω t ) dt = (13)
0
2

From this we write the equation to obtain an, which are the coefficients of each of
the sine waves as follows
T
2
f (t ) sin ( n ω t ) dt
T ∫0
an = (14)

The an is then computed by taking the signal over one period, successively
multiplying it with a sine wave of n times the starting fundamental frequency and then
integrating. This gives the coefficient for that particular harmonic.

Imagine we have a signal that consists of just one frequency, we think it is around 5
Hz (and is a sine wave from). We begin by multiplying this signal by a sine wave of
frequency .2 and each of its harmonics which are .4, .6, .8 ,…..10 and so on. Actually
Easy Fourier Analysis Part 1 Complextoreal.com 16
since we know it is in the range of 5 Hz, we can dispense with the lower harmonics say
up to 4 and start with 4.2 and go to 5.8 Hz.

Here is all the math we do.

1. Multiple the wave with a sine wave of frequencies 4.2 and integrate the result.
Most likely the result will be zero.
2. Go to next harmonic, which 4.4. This is 22nd harmonic of the resolution
frequency .2 Hz.
3. Repeat step 1 and 2 and continue until harmonic frequency is equal to 5.8 Hz.

The results will show that the integrals of all harmonics frequencies are zero, except
for the 25th harmonic, the integral of which will be equal to

a25T
= = 2.5a25
2
One period integral
a25 =
2.5

Where T = 1/f = 1/.2 = 5 sec. The coefficient can now be calculated which gives the
amplitude of the wave. (We already know its frequency, which is 5 Hz, since the
integral is non-zero for that component.).

Computing coefficient of cosines, bn

Now instead of multiplying by a sine wave we multiply by a cosine wave. The


process is exactly the same as above.

0 0
6447448 64444
4744444
8
T T T T

∫ f (t ) cos ( nω t ) dt = ∫ a0 cos ( nω t ) dt + ∫ an sin ( nω t ) cos ( nω t ) dt + ∫ bn cos ( nω t ) cos ( nω t ) dt


o 0 0 0

Now terms 1 and 2 become zero. (First term is zero from rule 1, the second term
due to rule 3.) The third terms is equal to

T
bnT
∫b n cos ( nωt ) cos ( nωt ) dt = (14)
0
2

and the equation can be written as

Easy Fourier Analysis Part 1 Complextoreal.com 17


T
2
bn = ∫ f (t ) cos ( nωt ) dt (15)
T 0

So the process of finding the coefficients is multiplying our signal with


successively larger frequencies of a fundamental wave and integrating the results. This
is easy to do in software. The results obtained successively are the coefficient for each
frequency of the harmonic wave. We do the same thing for sines and cosine
coefficients.

Following this process, we compute the coefficients of the following wave

Figure 20 - The signal to be analyzed

Without going through the math, we will give the answers in two vectors, first is the
coefficients of the sine and second the cosine waves and the dcoffset.

an = [.4 .3 .7 .3 .3 .3 .2 .3 .4]

bn = [.05 .2 .7 .5 .2 .2 .1 .05 .02]

a0 = .32

From this we can write the equation of the above wave as

f (t ) = .32 + . 4sin(2π 1)t + .3sin(4π )t + .7 sin(6π )t


+ .3sin(8π )t + .3sin(10π )t + .3sin(12π )t + .2sin(14π )t + ....
+.05cos(2π 1)t + .2 cos(4π )t + .7 cos(6π )t + .5cos(8π )t +
+.2 cos(10π )t + .2 cos(12π )t + .1cos(14π )t + ...

The coefficients are the amplitudes of each of the harmonics. The resolution
frequency is 1 Hz and the harmonics are integer multiples of this frequency. Now we
know exactly what the components of the received wave are. If the transmitted wave
consisted only of one of these frequencies, then, we can filter this wave and get back
the transmitted signal.
Easy Fourier Analysis Part 1 Complextoreal.com 18
Summary

The Fourier series is given by

∞ ∞
f (t ) = a0 + ∑ an sin(ωnt ) + ∑ bn cos(ωnt )
n =1 n =1

where

ωn = 2π nf

The coefficients of the Fourier series are given by

T
1
a0 =
T ∫ f (t )dt
0
T
2
f (t ) sin ( nω t ) dt
T ∫0
an =
T
2
bn = ∫ f (t ) cos ( nω t ) dt
T 0

where ω is the fundamental frequency and is related to T by

n
ωn = 2π f n = 2π
T

Coefficients become the spectrum

Now that we have the coefficients, we can plot the magnitude spectrum of the
signal.

Easy Fourier Analysis Part 1 Complextoreal.com 19


0.8
0.7 Sine
0.6
Cosine
Magnitude
0.5
0.4
0.3
0.2
0.1
0
Frequency

Figure 21 - The Fourier series coefficients for each harmonic

You may now say that this spectrum is in terms of sines and cosines, and this is not
the way we see it in books. The spectrum ought to give just one number for each
frequency.

We can compute that one number by knowing that most signal are represented in
complex notation where sine and cosine waves are related in quadrature. The total
power shown on the y axis of the spectrum is the power in both the sine and cosine
waves in the real and imaginary components of the same frequency. We can compute
the magnitude by from the root sum square of the sine and cosine coefficients for each
harmonic including the dc offset of the zero frequency value.

Magnitude = an2 + bn2

Plot the modified spectrum

1.20
1.00
Magnitude
0.80
Magnitude

0.60
0.40
0.20
0.00
Frequency

Easy Fourier Analysis Part 1 Complextoreal.com 20


Figure 22 - A traditional looking spectrum created from the Fourier coefficients

Voila! Although this is not a real signal, we see that it now looks like a traditional
spectrum. The largest component is at frequency = 3. The y-axis can easily be
converted to dB. In complex representation, the phase of the signal is defined by

φ n = tan −1 ( bn / a n )

For every frequency, we can also compute and plot the phase. Phase plays a very
important role in signal processing and particularly in complex representation and
shows useful information about the signal.

One thing you may not have noticed during this computation of the coefficients is
that they will be different depending on what you pick as the resolution frequency. We
will get different answers depending on the choice we make for this number. In essence
depending on the resolution, the signal energy leaks from one frequency to the next so
we get different answers, but the overall picture remains the same. The issues of
leakage will discussed later.

We also stated that the wave has to be periodic. But for real signals we can never
tell where the period is. Random signals do not have discernible periods. In fact, a real
signal may not be periodic at all. In this case, the theory allows us to extend the
“period” to infinity so we just pick any representative section of our signal or even the
whole signal and call it “The Period”. Mathematically this assumption works out just
fine for real signals.

Figure 23 - We call the signal periodic, even though we don’t know what lies at
each end.

Figure 24 - Our signal repeated to make it mathematically periodic, but ends


do not connect and have discontinuity

Easy Fourier Analysis Part 1 Complextoreal.com 21


The part of the signal that we pick as representing the real period is only a sample
of the whole and not really the actual period. The end section of the chosen section will
most likely not match as they would for a real periodic signal. The error introduced into
our analysis due to this end mismatch is called aliasing. Windowing functions are used
to artificially shape the ends so that they are zero at the ends and so the chosen signal
portion is made artificially periodic. This introduces errors in the analysis which have
to be dealt with by other techniques.

Next the complex representation.

Copyright 1998, All rights reserved C. Langton


Revised 2002

I can be reached at
mntcastle@earthlink.net

Other tutorials at
www.complextoreal.com

Easy Fourier Analysis Part 1 Complextoreal.com 22


SIGNAL PROCESSING & SIMULATION NEWSLETTER

Tutorial 6 - Fourier Analysis Made Easy Part 2

Complex representation of Fourier series

e jwt = cos wt + i sin wt (1)

Bertrand Russell called this equation “the most beautiful, profound and subtle expression
in mathematics.”. Richard Feyman., the noble laureate said that it is “the most amazing
equation in all of mathematics”. In electrical engineering, this enigmatic equation is
equivalent in importance to F = ma.

This perplexing looking equation was first developed by Euler (pronounced Oiler) in the
early1800’s. A student of Johann Bernoulli, Euler was the foremost scientist of his day.
Born in Switzerland, he spent his later years at the University of St. Petersburg in Russia.
He perfected plane and solid geometry, created the first comprehensive approach to
complex numbers and is the father of modern calculus. He was the first to introduce the
concept of log x and ex as a function and it was his efforts that made the use of e, i and pi
the common language of mathematics. He derived the equation ex + 1 = 0 and its more
general form given above. Among his other contributions were the consistent use of the
sin, cos functions and the use of symbols for summation. A father of 13, he was a prolific
man in all aspects, in languages, medicine, botany, geography and all physical sciences.

ejwt in Euler’s equation is a decidedly confusing concept. What exactly is the role
of j in ejwt? We know that it stands for −1 but what is it doing here? Can we visualize
this function?

Before we continue the discussion of Fourier Series and its complex


representation, let’s first try to make sense of ejwt as it relates to signal processing.

Take any real number, say 3, and plot it on a X-Y plot as in Fig 1a. Multiply this
number by j, so it becomes 3j. Where do we plot it now? Herein lies our answer to what
multiplication with j does.

Tutorial 6 - Fourier Analysis Made Easy Part 2 Page 1


Charan Langton, complextoreal.com
Y

3j

Y Each time the number is


multiplied by oi,
it shifts by 90 .

3i
X
Phase shift due to -3 3
multiplication with j

X
3 -3j

Figure 1a - Relationship of real Figure 1b – Multiplication with j


and imaginary numbers represents a phase shift

The number stays exactly the same, 3j is the same as 3, except that multiplication
with j shifts the phase of this number by +90o. So instead of an X-axis number, it
becomes a Y-axis number. Each subsequent multiplication rotates it further by 90o in the
X-Y plane as shown in Figure 1b. 3 become 3j, then -3 and then -3j and back to 3 doing
a complete 360 degree turn. Division by j means the opposite. It shifts the phase by -90o.
(Question: What does division by -j mean?)

This is essentially the concept of complex numbers. Complex numbers often


thought of as “complicated numbers” follow all of the common rules of mathematics.
Whereas in calculus of real numbers, we deal with numbers along a line in one
dimension, in complex math, we allow numbers to move in many dimensions and have
an another property called phase associated with them. Perhaps a better name for
complex numbers would have been 2D numbers.

To further complicate matters, the axes, which were called X and Y in our
Cartesian mathematics are now called respectively Real and Imaginary. Why so? Is the
quantity 3j any less real than 3?

This semantic confusion is the unfortunate result of the naming convention of


complex numbers and helps to make them confusing, complicated and of course complex

Tutorial 6 - Fourier Analysis Made Easy Part 2 Page 2


Charan Langton, complextoreal.com
Y

3 3+j3 ejwt

sin wt

X X
3 cos wt

Figure 2 – a. Plotting complex numbers


b. plotting a complex function

Now let’s plot a complex number, 3 + j3. In Cartesian math we would write this
number as (3,3) indicating 3 units on the X-axis and 3 units in the Y-axis. Similarly, the
real quantity is plotted on the X-axis (real part) and the j coefficient (imaginary part) is
plotted on the Y-axis. These are the X-Y projections of this number. The projection
magnitudes are real and not encumbered by the vexing j.

A complex number can have for its coefficients, instead of numbers, equations
(cos x, sin x). We plot these in exactly the same way as shown in Figure 2b except that X
and Y projections instead of being numbers, are functions, namely sine and cosine in this
case.

Now let’s take a look at the ejwt again. It is called a Cisoid {(cos x + j sin x)usoid} from
contraction of the parts of the Euler’s equation.

Now forget about the ejwt part and concentrate only on the RHS containing sines
and cosines.

e jwt = cos ωt + j sin ωt

We plot this function by setting the X-axis = cos wt and the Y-axis = sin wt. This
plot is shown in Figure 3.

Tutorial 6 - Fourier Analysis Made Easy Part 2 Page 3


Charan Langton, complextoreal.com
Figure 3 – ejwt plotted in three dimensions is a helix

Imaginary Axis

sin wt

cos wt Time

Real Axis

In Figure 3 cos wt is plotted on the Real axis and sin wt is plotted on the
Imaginary axis. The function looks like a helix moving forward in time to the right. The
X-Z and the Y-Z projections, if plotted, would be the sine and cosine functions.

Had we plotted the function e-jwt, we would have seen that it moves to the left
instead of to the right. This direction of rotation has important implications for the
definition of frequency.

The quantity “ee-to-the-jay-omega-tee” is a mouthful and is commonly called a


Phasor, particularly in electrical engineering. Phasors are plotted with time dimension
suppressed, so they look like a vector frozen in time with its plane rotating with the
angular frequency of the cisoid.

Now let’s express sines and cosines in terms of our new quantity ejwt. So we have

e jwt = cos wt + j sin wt


and (2)

e − jwt = sin wt − j cos wt

Tutorial 6 - Fourier Analysis Made Easy Part 2 Page 4


Charan Langton, complextoreal.com
Manipulating these two equations, we get

e jwt − e − jwt
sin wt =
2j (3)

e jwt + e − jwt
cos wt =
2

Now let’s just substitute Q+, for ejwt and Q- for e-jwt , we get

Q+ + Q−
cos wt =
2 (4)
Q − Q−
sin wt = +
2j

The use of Q is just to make it easier to see what is happening. We have redefined
sine as a difference between two phasors Q+ and Q- and cosine as the sum of the same of
the same two phasors. The presence of j in the definition of sine means that it is -90o to
the other term and nothing more. So mentally erase the j in the denominator, if it bothers
you.

The phasor Q+ is arbitrarily defined to rotate in the counterclockwise direction


and the Q- phasor in the clockwise direction. The vector sum of these two phasors is
changing with time and represents the cosine and sine functions. In Figure 4 we show
two phasors at a particular time. They always rotate in opposite directions and meet each
other at 0 and 180 degrees. Their instantaneous vector sum equals the quantity (2
cos(wt)) and their vector difference equal (2 sin(wt).)

Y
2sinwt = ejwt - e-jwt

e-jwt ejwt

Q- Q+ Phasor Q+ rotates
counterclockwise
with time

X
Phasor Q- rotates
clockwise
with time 2coswt = ejwt + e-jwt

Figure 4 – ejwt and e-jwt phasors

Tutorial 6 - Fourier Analysis Made Easy Part 2 Page 5


Charan Langton, complextoreal.com
In Figure 5 we plot the progression of these two phasors to see how their sum and
differences would equal the cosine and sine function. Each picture depicts the phasors at
a particular time. Time is increasing as one moves from left to right then to retrace as in
reading a page.

Imaginary Imaginary

2 sinwt = 2/sqrt(2)

ejwt
1
2 sinwt = 0 1 ejwt 2
Real
2 cos wt = 2 Real 2 coswt = 2/sqrt(2)
1 e-jwt
1
e-jwt

Figure 5a - Phasor representation of sine and cosine, 1. Wt = 0, 2. Wt = pi/4

At t = 0, both phasors are horizontal. Their vector sum is twice the length of each.
So cos wt = 1 and since the difference is zero, sin wt = 0

At t = pi/4, the Q- phasor has rotated up to pi/4 and the Q- phasor has rotated to -
pi/4. Now their vector sums, give us cos wt = 1/sqrt 2 and their difference gives also
1/sqrt2.

3. wt = π/2 4. wt = 3π/4
Imaginary Imaginary

ejwt At wt = -3pi/4
ejwt

2 sinwt = 2

Real Real
2 coswt = -2/sqrt(2)
2 cos wt = 0
2 sinwt = 2/sqrt(2)

e-jwt
e-jwt

Figure 5b - Phasor representation of sine and cosine, 1. Wt = pi/2, 2. Wt = 3pi/4

At t = pi/2, Q+ phasor has rotated upright and the Q- has rotated down to the
opposite side. Now the vector sum gives us the cos wt = 0 and sin wt = 1.

Tutorial 6 - Fourier Analysis Made Easy Part 2 Page 6


Charan Langton, complextoreal.com
At t = 3pi/4, we get the same situation as at t = 0, but the cosine term is negative
as it should be.

Imaginary
5. wt = π

ejwt
Real
-2 cos wt = -2 e-jwt 2 sin wt = 0

Figure 5c- Two phasors at wt = pi/2

At wt = pi/2, the phasors meet again. The sine term which is the difference is once
again zero and the cosine term is the sum of the two magnitudes and as such cos wt = 1
and sin wt =0.

By following each phasor we see that at every t, we get the conventional and
correct values of sine and cosines.

Now we make the following important points that will help us in dealing with concepts of
negative frequency and signals in quadrature.

1. Cosine wave is sum of two phasors rotating in opposite directions divided by 2.


2. Sine wave is difference of the same two phasors divided by 2.
3. Since any real periodic signal can be represented as a sum of sines and cosines, then
it also be represented as a sum of positive and negative phasors (also called
exponential).
4. Just as we could create a spectrum out of the coefficients of the sinusoids, we can do
the same thing out of the coefficients of the phasors.

If we think about sine and cosines strictly in terms of phasors and forget about the
old trigonometric definition of sine in terms of frequency and amplitude, we can talk
about (but using old terminology) the concept of negative frequency.

Tutorial 6 - Fourier Analysis Made Easy Part 2 Page 7


Charan Langton, complextoreal.com
We can say that both sine and cosine waves are made up of two quantities called
phasors, a phasor of positive frequency, ejwt and a phasor of negative frequency, e-jwt. So
both sine and cosine contain negative frequency content. The idea is similar to talking
about negative colors or negative people. These are perceived as physical properties and
it is hard for us visualize them as negative. But when seen from a mathematical
perspective, there is such a thing as a negative color; white can bee seen as negative of
black and according to my esteemed colleague Dr. Dave Watson, there is definitely such
a thing as “negative person.” but of course none in Advanced Systems!

This terminology is confusing because in complex domain we are not talking


about frequency at all but the exponent of the exponential, ejwt. The Q+ phasor represents
the positive frequency content and the Q- phasor the negative frequency because of the
sign of the exponent. Each phasor then represents only the positive or the negative
frequency.

Here is a hardware oriented view of negative frequency. A two-pole permanent


magnet AC generator connected to same shaft with their field windings in space
quadrature will produce a positive frequency output by driving the shaft in one direction
of rotation. And a negative frequency output when driven in the opposite direction. So it
is direction of the motion that determines the sign of the frequency.

The difficulty is that frequency is really a two dimensional concept but is often
seen only as one. Two dimensions are needed to describe a frequency, its cycles per
second and its direction of rotation. Historically we have always talked of frequency as a
physical quality of a wave. Spectrum analyzers and other electrical measuring devices are
one dimensional as well which limits our understanding of the general concept of
frequency.
The general concept of frequency can be written as follows


f =
dt

We can define frequency as the rate of change of phase over time. So a + 2π rotation
over half second means the frequency is 2. And here we see that if phase rotates around
counter-clockwise, then we have the definition of positive frequency and when it goes the
other way then it is negative. A - 2π rotation over half second means the frequency is -2.

Velocity or speed which we also tend to think of as a scalar has a similar confusing
aspect. We can talk about 60 miles per hour and this makes perfect sense. But what does
–60 miles per hour mean? Mathematically it is a perfectly OK construct. It just means
same speed but going backwards. The concept of negative frequency is just as simple as
that.

What use is ejwt? Why bother with it at all?

Tutorial 6 - Fourier Analysis Made Easy Part 2 Page 8


Charan Langton, complextoreal.com
Recall that we can use a sinusoid as a filter. When we multiply a signal by a
sinusoid of a particular frequency, the product when integrated reveals the frequency of
the sinusoid hidden in the signal. To compute trigonometric coefficients, this is
essentially what we do, we multiply a random signal by sinusoids of different frequencies
to yield all its frequency components. Multiplying by ejwt does exactly same thing.
Except that now instead of doing sines and cosines one at a time we can do them both
together. The function allows us to deal with two dimensional signals together.

We can also interpret the multiplication as a form of frequency shifting. When we


multiply a signal by ejw0t, then we are essentially isolating and shifting that signal to the
w0 frequency to the right. When we multiply it by a e-jw0t, then we are shifting it leftwards
to - w0.

Figure below shows the effect of this multiplication. Figure 8a shows the
Amplitude spectrum centered about frequency = 2. Multiplying this signal by e j ( 2πf ) t
where f = 2 causes the spectrum of the new signal to shift to 4 for a total shift of f = 2.
When we multiply this signal by e j ( 2πf ) t where f = -2 causes the spectrum of the new
signal to shift to 0 for a total shift of f = -2 as in Figure 8c.

This important property of Cisoid allows us to shift signals from baseband to


carriers and vice versa. It is a fundamental equation whenever we talk about modulation.

0 1 2 3 Frequency

Figure 6a - Amplitude Spectrum of an arbitrary signal f(t)

Tutorial 6 - Fourier Analysis Made Easy Part 2 Page 9


Charan Langton, complextoreal.com
Here is a wave Page 1 of 20

SIGNAL PROCESSING & SIMULATION NEWSLETTER

Discrete Fourier Transform (DFT) and the FFT

Let’s take this continuos signal composed of three sinusoids.

g ( t ) = cos( 2π f a t ) − 13 cos( 2π 3 f bt ) + 15 cos( 2π 5 f c t )

Assume that fa = 1, fb = 3, and fc = 5. The waveform is plotted below.

Figure 1 - A signal representing a square wave

We can draw the Fourier transform of this signal easily by examining the amplitudes of each of these frequencies
and then putting one-half on each side of the y-axis as shown in Fig. 2 for a two sided spectrum. Real signals such
as this one produce only one sided spectrums also shown below.
G(f)
G(f)
1

1/2
1/6 1/3
1/10 1/5

f f
Figure 2 - The two-sided and single-sided Fourier Transform of g(t)

This is the theoretical Fourier Transform of the continuos waveform g(t). The Fourier Transform tells us that there
are just three frequencies in the signal and no others. There is no ambiguity in the results. This ideal Fourier
Transform is what we want to see when do the Fourier Transform on a analyzer or on a computer but in reality
this is nearly impossible to obtain. All implementations of the Fourier Transform are attempts to achieve the
theoretical results, however, digital signal processing introduces approximations and truncation effects which
keep us from realizing the ideal.

Figure 3 shows the outline of the same signal along with dots that represents what we actually see of the
signal on a oscilloscope. This is because most signals we capture are sampled versions of the real analog signal.
We pulse the analog signal every so often and then plot these sampled values. We connect the samples and get a
proxy to the signal.

http://complextoreal.com/fft3.htm 5/4/2006
Here is a wave Page 2 of 20

Figure 3 - The discrete samples of a real signal as shown by dots. We really do not know the underlying shape of the
signal.

Mathematically, the sampled signal is obtained by multiplying the target signal with an impulse train of
period τ. Since we usually collect only a limited number of samples we limit the length of the impulse train to a
certain time window. The discrete signal is expressed as

g ( k τ ) = g ( t )δ ( t − kτ )

So before we can even look at a signal, two things have happened. 1. we have multiplied the target signal
by an impulse train and made the continuos signal a discrete signal and 2. we have chosen to collect only a limited
number of samples, in effect windowing the sequence with a rectangular window function.

Fig 4a shows the original signal and its Fourier Transform. In (b) we have the Fourier Transform of a
pulse train which is used for sampling the original signal. The Fourier transform of the impulse train consists of
just one frequency, the sampling frequency.

Next step is the rectangular window that limits the infinite impulse train. Its Fourier Transform is shown
in c and is the well-known sinc function.

Now we have a signal which is a product of three signals.

g ( kτ ) = g ( t ) δ ( t − kτ ) u( t ) for t < T
1 2 3

The first is the original signal, the second is the impulse train of period τ and the third is a step function
lasting for time T. What about the Fourier Transform of the product of these three signals? Mathematically we
know that multiplication in time domain of two signals results in convolution of their spectrums in the frequency
domain. So we have an inkling that the convolution of all three of the Fourier Transforms may not give us the
spectrum in (a). But is it close enough to (a), and if not how different is it?

http://complextoreal.com/fft3.htm 5/4/2006
Here is a wave Page 3 of 20

The target signal


g(t) G(f)

g(t) (a)
t f

Infinite impulse train


F(f)

(b)
fs(t) t -fs fs f

g(t)
Limiting window W(f)

(c)
w(t) f

Sampled and limited signal of length N samples G(f)

?
(d)
g(kτ) t f

Figure 4 - The quandary of digital signal processing


a. The continuos target signal, b. is multiplied by an impulse train of frequency fs, c. The limiting window of length T,
d. The sampled and limited signal, what do we get here?

Let’s define some terms.

Sampling frequency: fs

Sampling frequency is a measure of how often we pulse the continuos signal to obtain the samples. The
quantity sampled is the amplitude of the signal.

Sample Time: τ

Τime between each sample. It is also the inverse of the sampling frequency.
If sampling frequency, fs = 20 samples/sec, then

τ = 1/fs = .05 sec

http://complextoreal.com/fft3.htm 5/4/2006
Here is a wave Page 4 of 20

Total Number of Samples: N

The total number of samples collected or available = N

Sequence Time Length: T

This the time length of the collected sequence and is equal to the product of the sample time and the total
number of samples.

=Nτ

Sample index: k

The sequence time is no longer continuos so instead of t, we use a discrete time measure called kth sample. This is
an index of the samples. Its range extends from 0 to N-1, where N is the last sample. Each kth sample of total N
samples, is located at time k times τ secs.

Kth
τ τ τ τ τ τ τ

0 1 2 3 4 . k N-1

Figure 5 - Referring to individual samples

In a continuos signal we refer to a particular point at its instantaneous value of t. For discrete signals, We
refer to any particular sample as g(kτ). So each sample differs in time from the previous one by τ secs. For
example the 3rd sample similarly is located at (3 x .05) = .15 secs and the 10th sample is located at time (10 x .05)
= .5 secs..

Define the g(t) in its discrete form as

g(t) = g(k τ)

Harmonic index: n

Frequencies that are integer multiple of a fundamental frequency are referred to as harmonics of that
fundamental frequency. In computing DFT, we use the concepts of harmonics in a special way.

From the sampling theorem, we know if we want to recreate a signal from its samples then we must
collect at least twice its frequency number of samples per second. This also says that we can detect frequencies in
a signal only up to one half of its sampling frequency. So the values of n ranges from

fs f
n ≤ s
N 2
N
or n ≤
2

This says that we can only detect half as many harmonics as the total number of samples. However the
index itself goes from -(N-1) to +(N-1) and spans both sides of the spectrum reflecting the positive and negative
components of the frequency.

http://complextoreal.com/fft3.htm 5/4/2006
Here is a wave Page 5 of 20

Relating the Discrete Fourier transform to the Continuous Fourier Transform

Recall that the Fourier transform is given by

+∞
G( f ) = ∫ g( t ) e − j ω t dt -1-
−∞

The above equation says that if we multiply the target signal by a complex sinusoid of harmonic frequencies 1, 2,
3, ..n one at a time and then integrate the results, the integration yields the amplitude of the nth harmonic. Why?
Because multiplication by the sinusoid acts as filter for all other frequencies. (Refer to Fourier Transform
Tutorials No. 1 and 2). The objective is to compute the complex coefficients cn, which when plotted give us the
frequency content of the signal.

+∞
a n = ∫ g( t )sin( nω t )dt = amplitude of the n harmonic sine wave
−∞ th

+∞
bn = ∫ g( t ) cos( nω t )dt = amplitude of the n harmonic cosine wave
−∞ th

c n = a n 2 + bn 2 the complex coefficients which produce the spectrum

The integration limits in the Fourier transform formula of Eq. 1 go from - ∞ in to + ∞ in. What does that mean
for our sampled sequence of N samples?

Fourier Transform also requires that the signal be periodic. But looking at only N samples we can not tell if the
samples cover one exact period, more than one or less than one period. In order to do the Fourier Transform, we
need at least one whole period or the result is suspect.

We already see some problems as we go from continuous to discrete processing, The problems are

1. We do not have an infinitely long series and


2. We do not know if the N samples we have observed cover a single period,
less than a single period or more than one.

Let’s continue despite the fact that we don’t know if what we are about to do is right. We are going to assume that
these two things will not cause us much trouble and the results will be acceptable.

Now let’s change time from continuos to discrete by making the following substitutions for time and frequency.

g(t) = g(k τ)

ω n = 2π f n

Equation 1 becomes

N −1
G( f n ) = ∑ g( kτ ) e − j( 2π f n )( kτ )

k =0 -2-

http://complextoreal.com/fft3.htm 5/4/2006
Here is a wave Page 6 of 20

We have also changed the integral to summation to note the change from continuous to discrete as two processes
are equivalent in the two domains.

Fundamental frequency of the signal

By applying the Fourier Transform algorithm on these N samples, we have made an implicit assumption. We have
assumed that the signal is periodic over N samples, so we have assumed that the fundamental frequency of our
signal is equal to the inverse of time T of the N samples. We express the fundamental frequency as

1
f0 =
T

We can rewrite T as a function of sample time, τ and total number of samples chosen, N to alternately express the
fundamental frequency in terms of fs and N.

1 1
f0 = =
τN sec s
x Total no. of sample
sample
fs
f0 =
N

This is a very important concept to understand. It says that you have artificially set the fundamental frequency to
the sampling frequency divided by the total number of samples observed. It is a strange idea seemingly having
nothing to do with the target signal and in fact this is true.

This frequency referred to as the fundamental frequency of the signal really is kind of a resolution frequency and
has nothing to do with the target signal. It just means that we resolve the target signal components in integer
multiples of this resolution frequency.

Let’s say that we sampled the above signal at sample time of 1/20th sec and observed 60 samples. Then the
fundamental frequency is

fs 20
f0 = = = .333 Hz
N 60

Now when we compute the Fourier Transform we will be stepping this fundamental frequency by integer
multiples. With f0 = .333, the next harmonic would be f1 = .666 and so on. The harmonics used in the analysis are
not integers but integer multiple of the fundamental frequency of the signal as determined by the sampling
frequency and the N samples observed. An alternate way to see these harmonics is see them as bins which collect
energy. In DFT they are also called cells.

Now the nth harmonic can be expressed as n times f0.

fn = n f0

this is also equal to

http://complextoreal.com/fft3.htm 5/4/2006
Here is a wave Page 7 of 20

n n fs
fn = =
τN N

Now we rewrite the Fourier Transform substituting above expression for fn in Eq. 2.

n
N −1 − j ( 2π )( kτ )
G( f n ) = ∑ g ( kτ ) e τN
k =0

τ’s cancel and we get,

N −1
⎛ n ⎞ − j 2π n k
G⎜ ⎟=
⎝τ N ⎠
∑ g( kτ ) e N

k =0

N −1
⎛ n ⎞ 1 − j 2π n k
G⎜ ⎟=
⎝τ N ⎠ N
∑ g( kτ ) e
N

k =0 -3-

The above form of the Fourier Transform is called the Discrete Fourier Transform (DFT). The Division by N is
used to normalize the values.

DFT is a special case of the Fourier Transform and is actually an approximation of the real thing. The validity of
the approximation is effected by the type of waveform we are dealing with as well as the parameters fs and N.

Computing the DFT

The process of computing the DFT is identical to computing the Fourier coefficients we did in Tutorial 1.

Here you need to know

1. What is the sampling frequency of the target signal? Is the sampling frequency large enough so that it covers all
significant frequencies in the signal?
2. How many samples do we need?

First compute the fundamental frequency, and starting with the fundamental frequency we multiply the discrete
signal by a complex exponential and perform summation on the result.

Do you recall what it means to multiply by a complex exponential? How do you interpret the following equation?

f ( t ) e − j 2πft

The figure below shows what is happening in real-life.

http://complextoreal.com/fft3.htm 5/4/2006
Here is a wave Page 8 of 20

cos(2 π ft)

X f(t) cos(2 π ft)

f(t)

X f(t) sin(2 π ft)

sin(2 π ft)

Figure 6 - What we are really doing when we multiply by a complex exponential

The signal in fact is being split into two parts, 1. multiplied by a sine wave and the other by a cosine of the same
frequency. The resulting two signals are orthogonal and are the result of multiplication with the complex
exponential or phasor.

DFT Step by step

Now we compute the DFT of the signal in Fig 1.

Step 1 - Multiply the target signal in 7a by a cosine wave in 7b of frequency f0. For this demonstration, we
assume that f0 = 1. (Although only cosines are shown, we do this for both sines and cosines and keep track of the
results separately.)

Figure 7a - The sampled target signal

Figure 7b - First Harmonic f1 = 1 * f0

http://complextoreal.com/fft3.htm 5/4/2006
Here is a wave Page 9 of 20

Figure 7c - result of multiplying the first harmonic with the target signal. The waveform has positive area.

The multiplication gives us the waveform in 7cNow integrate this waveform over the N samples. In a discrete
case, we integrate by multiplying the sample amplitude by the width of the base which is equal to τ, the sample
time, using the trapezoidal rule. We are in effect adding up the areas of all the small gray rectangles in Figure 7c.
Each sample value is multiplied by τ and these areas are summed.

The result of the multiplication tells us something interesting. We see that the resulting waveform is not even, so
it has net area under it. This means that there is a signal hiding in this frequency. What is the amplitude of this
frequency? That we know only when we complete the summation. The result of the summation gives us the
amplitude of this harmonic in the target signal.

Step 2: Now multiply the Signal in 7a with the second harmonic as shown in Figure 7d. The multiplication gives
the waveform in Figure 7e.

Figure 7d - 2nd Harmonic f2 = 2 * f0

Figure 7e - Result of multiplying the 2nd harmonic with the target signal. The waveform has no area.

The waveform of 7e is even, which means that the summation of the little gray rectangles will give zero area.
Since it has no net area means there is nothing of interest here.

Let’s go to the next harmonic. Now multiply the target signal with the 3rd harmonic as in Fig 7f. The resulting
waveform is shown in Fig 7g.

http://complextoreal.com/fft3.htm 5/4/2006

You might also like