fft1

Embed Size (px)

Citation preview

  • 7/29/2019 fft1

    1/23

    1Charan Langton, www.complextoreal.com

    Fourier Analysis Made Easy

    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 amous Fourier series approximately 120 years ater Newton published the rst bookon Calculus. It took him another twenty years to develop the Fourier transorm which made the theoryapplicable to a variety o disciplines such as signal processing where Fourier analysis is now an essentialtool. It seems that Fourier did little to develop the concept urther and most o this work was doneby Euler, LaGrange, Laplace and others. Fourier analysis is now also used heavily in communication,thermal analysis, image and signal processing, quantum mechanics and physics.

    Fourier noticed that you can create some really interesting looking waves by just summing up simplesine and cosine waves. For example the wave in Figure 1, is a sum o the three sine waves shown in Figure2 o various requencies and amplitudes. From just this observation, Fourier correctly surmised that allkinds o interesting and useul waves could probably be created just by combining sines and cosines.

    Figure 1 - An interesting looking wave

    Figure 2 - Sine wave 1, Sine wave 2, Sine wave 3

    So although we know that the wave o Figure 1 is created rom the sum or superposition o the threeregular looking waves shown in Figure 2, we can represent this knowledge in a more interesting way. Letslook at the composite wave in three dimensions. When we look at the signal with time progressing to theright and the amplitude going up and down erratically, we are looking at the signal in what is called, theime Domain. Tis is the summed signal. When we look at the same signal rom the side, along the

  • 7/29/2019 fft1

    2/23

    2Charan Langton, www.complextoreal.com

    requency axis, now what we see are the constituent requencies along the requency axis. We also see thepeak amplitudes o these discrete requencies. Tis view o the signal is called the Frequency Domain.Another name or this view is the Signal Spectrum.

    Figure 3 - Looking at signals rom two dierent points o view

    Te concept o spectrum comes about rom the realization that any arbitrary wave contains within itmany dierent requencies. A real signal o any type is an assemblage o all kinds o requencies. Exampleso such a signals is voice, which varies in requency rom 30 Hz to 10000 Hz. Although the range orequencies is the same or most humans, the distribution o powers is dierent and results in a uniqueand recognizable sound. Te spectrum is a way to quantiy the power within each o the componentrequencies.

    Te spectrum o the composite wave o Figure 1 is composed o just three requencies and can bevisualized in Frequency domain as in Figure 4. Tis view is called a one-sided spectrum. One-sided notbecause any thing has been let out o it, but that only positive requencies are represented. (So what is a

    negative requency? Is there such a thing? We will discuss this in more detail in chapter 2.)

    Figure 4 - Te Frequency Domain spectrum o wave in Figure 1

    Te x-axis in this spectrum represents the requencies and y-axis is the amplitude or power in thoserequencies. ypically a spectrum represents power, so the y-axis value is the peak amplitude squared,hence it is always a positive quantity. But oten it is called amplitude, although technically this is notcorrect. Te width o the spectrum is called the bandwidth o the signal and the resolution o the

  • 7/29/2019 fft1

    3/23

    3Charan Langton, www.complextoreal.com

    requencies ( )1n nf f+ is called the bin size. Te bin size o a spectrum is constant and is an importantparameter in how well the signal has been represented.

    Te smallest requency (which has the largest amplitude in Figure 4) is called the FundamentalFrequency. All other requencies are integer multiples o this undamental requency in the analysis weare about to undertake. So i the smallest requency in a spectrum is 21.3 Hz, then the next harmonicwould be 2 times that. Te bin size in this case would be 21.3 Hz as well.

    A spectrum is a graphical representation o the power content o the undamental requency and allits harmonic or integer multiples. Tis graphical representation is a unique signature o the signal at aparticular time. A spectrum hence is not a static thing and changes as the signal changes.

    Te process o breaking down any arbitrary wave into its harmonic components and identiying theircontents, that is their amplitudes, is called Fourier Analysis.

    Lets take the ollowing wave, which we will call our signal o interest. It was created by adding manydierent requencies o various amplitudes.

    Figure 5 An arbitrary signal o interest

    Notice that the wave is periodic. Fourier analysis says that any arbitrary wave such as this that isperiodic can be represented by a sum o sine and cosine waves. O course, in reality, the component wavesmay or may not be harmonic. But thanks to Fourier analysis we can decompose this signal into harmoniccomponents. And that is oten good enough to understand the properties o most real signals.

    Lets try summing a bunch o sine and cosine waves to see what we get.

  • 7/29/2019 fft1

    4/23

    4Charan Langton, www.complextoreal.com

    Figure 6 - Four sine waves with requencies 1 to 4 Hz

    Starting with the rst wave o 1 Hz, each wave has a requency which is an integer multiple o thesmallest requency (2, 3 and 4 Hz.)

    Any two requencies i their ratio is an integer are harmonic to each other, hence these waves areharmonics o each other. We write the sum o K such harmonic sine waves as

    1

    ( ) sin( )K

    n

    f t n t=

    = (1.1)

    Here is what the sum o the our sine waves o Figure 6 o equal amplitude, each starting with a phaseo zero radians at time zero looks like.

    Figure 7 - Te sum o our sine waves.

    Te sum o a large number o sine waves o equal amplitude approach an impulse-like unction asshown in Figure 8 or N = 20. Tis graph was created by adding 20 sine waves, each o amplitude 1.0and starting phase o 0 degrees.

  • 7/29/2019 fft1

    5/23

    5Charan Langton, www.complextoreal.com

    Figure 8 - Te sum o 20 harmonic sine waves.

    We see two interesting things, one that the peak value is not the sum o the number o harmonics. Temaximum amplitude is not equal to 20. Sine waves o harmonic requencies do not have synchronouspeaks. So the peak never adds to a linear sum o the amplitudes. Tis because all harmonic sine wavescross the x-axis at the same time but never peak at the same time, as opposed to cosine waves which peakat the same time but never cross the x-axis at the same time as we can see in Figures 9 and 10 .

    Te closed orm solution o this summation is given by the ollowing equation.

    ( )

    0

    1 1sin sin 1

    2 2sin( )

    1sin

    2

    N

    n

    N N

    n

    N

    =

    +

    =

    (1.2)

    Figure 9 Tese three harmonic sine waves all start at 0, and cross the x-axis at the same time. Note they all start at

    zero.

    Figure 10 Harmonic cosine waves peak synchronously. Note they all start at 1.0

    Sine waves are considered oddunctions rom the ollowing denition.

    ( ) ( )f x f x= (1.3)

  • 7/29/2019 fft1

    6/23

    6Charan Langton, www.complextoreal.com

    Cosine waves are called even unctions by a similar denition.

    ( ) ( )f x f x= (1.4)

    Now lets add a bunch o cosine waves o harmonic requencies to see what they look like.

    Figure 11- Four cosine waves o requencies 1, 2, 3, 4 Hz

    Te sum o these cosines o equal amplitude look like this.

    Figure 12 - Sum o our cosine waves o equal amplitude

    A sum o 30 cosine waves looks like as in Figure 13. It too approaches an impulse-like unction just asthe sum o sine waves did but this one is an even unction and its peak is equal to 30.

    Figure 13 - Sum o 30 cosine waves o equal amplitude

    Te closed orm solution or the summation o N cosine waves is given by

  • 7/29/2019 fft1

    7/23

    7Charan Langton, www.complextoreal.com

    ( )

    0

    1 1cos sin 1

    2 2cos( )

    1sin

    2

    N

    n

    N N

    n

    N

    =

    +

    =

    (1.5)

    Now lets allow the amplitude o the cosine and sine waves to vary. Here is what one particular sum oour cosines and sines o unequal amplitude looks like.

    Figure 14 - Sum o our cosine waves and sine waves o unequal amplitude.

    Te summation o sines always starts at zero whereas cosines always at one. Both sines and cosinesas well as their summations have some special properties. Cleaver combinations o arbitrary amplitudesand phases result in many useul waves. For example, we can create a square wave by the summing oddharmonics o sines.

    Question: Can we produce a square wave by summing cosine waves instead?No. Because a square wave is an odd unction and only summation o sines can produce a square

    wave.

    In Figure below, we add 3 sine waves o requencies 1, 3 and 5 to produce a wave that is starting to looklike a square wave. Summation o just ve odd harmonics gives a airly decent representation in Figure15.

    0 0 .5 1 1.5 2 2.5 3-1

    -0.8

    -0.6

    -0.4

    -0.2

    0

    0.2

    0.4

    0.6

    Figure 15 Creating a square wave rom odd harmonics o sines, (a) 3 sines waves, (b) 5 sine waves

    Te second square wave is the sum o ve sine waves o decreasing amplitudes. Each addition o asine wave (hence increasing bandwidth) reduces the central ripple and moves the wave closer to an ideal

  • 7/29/2019 fft1

    8/23

    8Charan Langton, www.complextoreal.com

    square wave. Te equation below gives the recipe o how this wave was created. Te square wave is anodd unction, so it can only be created rom sine waves which have the necessary property o oddness.Te even unctions on the other hand can only be created using cosine waves. Non-symmetric signalrepresentation would require both sines and cosines, such as or the signal in Figure 5.

    Here is the expression or creating a square pulse rom the summation o sine waves.

    ( )( )

    ( )1

    sin 2 2 14( )

    2 1

    4 1 1sin(2 ) sin(6 ) sin(10 )

    3 5

    k

    k ftsquare t

    k

    f t f t f t

    =

    =

    = + + +

    (1.6)

    Lets look at two more special signals, triangular wave and sawtooth wave.

    ( )( )( )

    ( )22

    0

    2

    sin 2 2 18

    ( ) 1 2 1

    8 1 1sin(2 ) sin(6 ) sin(10 )

    9 25

    k

    k

    k ft

    traingle t k

    f t f t f t

    =

    +

    = +

    = + +

    (1.7)

    Just looking at this equation, without knowing what it looks like, we know that since only sines areinvolved, this must be a odd unction. Te number o harmonics used to create the signal also tellsus something o its bandwidth. A perect reconstruction requires innite number o harmonics whichmeans innite bandwidth.

    Figure 16 riangular wave represented by sines

    A triangular wave is also an odd unction, which means it is constituted only o sine waves.

    ( )1

    1

    2 sin(2 )( ) 1

    k

    k

    kftsawtooth t

    k

    +

    =

    = (1.8)

    Rectied wave Tis is an even unction, so we have only the cosines in the equation

    ( )

    ( )0

    21

    cos 22 4( )

    4 1n

    f tA Af t

    n

    =

    =

    (1.9)

  • 7/29/2019 fft1

    9/23

    9Charan Langton, www.complextoreal.com

    Figure 17 Rectied wave represented by cosines

    Fourier Series

    Now we will put together what we have learned about harmonics or the creation o a general equationwhich can be used to represent any arbitrary periodic wave.

    Lets start with the two basic equations that sum harmonic requencies o sines and cosines o equalamplitudes.

    ( )11

    ( ) sin 2n

    f t n f t

    =

    = (1.10)

    ( )21

    ( ) cos 2n

    f t n f t

    =

    = (1.11)

    Here fis the undamental requency. We can also write these equations instead as

    ( )11

    ( ) sin 2 nn

    f t f t

    =

    = (1.12)

    ( )21

    ( ) cos 2 nn

    f t f t

    =

    = (1.13)

    Where nf is the nth harmonic o the undamental. Both o these equations can create a certain classo signals, such as odd or even. We already know what these summations look like. No matter how

    many sine waves we add, the starting point will always be zero. So i we want to create a wave that doesnot start at zero like the one in Figure 5, then we must include cosine waves in the ormulation. Wealso understand that we need to allow the amplitudes to vary i we are to create anything interesting.Summation o equal amplitude sines and cosines are not interesting. By allowing the amplitude to vary,we can create a huge variety o waves, both odd, even and those with no symmetry.

    Now lets include both sines and cosines in one equation, allowing their amplitudes to vary by addinga dierent coefcient or each.

  • 7/29/2019 fft1

    10/23

    10Charan Langton, www.complextoreal.com

    1 1

    ( ) sin(2 ) cos(2 )N N

    n n n n

    n n

    f t a f t b f t = =

    = + (1.14)

    Te coefcients an

    represent the coefcient o the nth

    sine wave and bn

    o the nth

    cosine wave.

    Tere is one other issue to tackle i we are to make this ormula truly general, capable o representingall kinds o waves. Te sum o sine and cosines is always symmetrical about the x-axis so there is nopossibility o representing a wave with a dc oset. o do that we must add a bias to Equation (1.14). Teconstant, 0a we add to Equation (1.14) moves the whole wave up (or down) rom the x-axis.

    01 1

    ( ) sin(2 ) cos(2 )N N

    n n n n

    n n

    f t a f b f ta = =

    = + + (1.15)

    Te coefcient a0

    provides us with the needed dc oset. Now with this equation we can describe anyperiodic wave, no matter how complicated looking it is. We know that ultimately we can represent it withjust ordinary sines and cosines.

    Question: Can we create an exponential and other non-periodic unctions with this ormulation?No. In act hidden in this ormula are exponentials. We can use exponentials to create periodic

    waves but not the other way around.

    Equation (1.15) is called the Fourier series equation. Te coefcients a0, a

    n, b

    nare called the

    Fourier Series Coefcients.

    An equation with many aces

    Tere are several dierent ways to write the Fourier series equation. One common representation is by

    radial requency. We can replace requency by and then write the equation as

    01 1

    ( ) sin( ) cos( )N N

    n n n n

    n n

    f t a a t b t = =

    = + + (1.16)

    For discrete representation, we dene as the period o the undamental requency (the lowestrequency in the set). Ten the period o the n

    thharmonic is /n and /nf n T= . We now write the

    Fourier equation as ollows

    01

    ( ) sin 2 cos 2n nn

    n nf t a a t b t

    T T

    =

    = + +(1.17)

    Te cosine representation, used oten in signal processing is written by incorporating a variable or thephase. Now sine wave is not necessary because by changing the phase we can create any wave.

    01

    ( ) cos( )n n nn

    f t C C w t

    =

    = + +(1.18)

    Here is one more way to write the same equation by pulling out the constant amplitude term to theront.

  • 7/29/2019 fft1

    11/23

    11Charan Langton, www.complextoreal.com

    01

    1( ) ( sin cos )

    2n n n n

    n

    f t a a f t b f t

    =

    = + +(1.19)

    We can also write the equation starting at zero requency. Now the bias term is included with the zerorequency.

    0

    1( ) ( sin cos )

    2n n n n

    n

    f t a f t b f t

    =

    = +(1.20)

    Additionally in its most important representation, the complex representation, the Fourier Equationis written as

    /( ) j n t T nn

    f t C e

    =

    = (1.21)

    Tis says that we can create a periodic unction by the summations o exponentials. Complex notation

    is a most useul albeit a scary looking orm. In next part, we will look at how it is derived and used orsignal processing.

    A beautiul example showing how a sine wave is actually the sum o very many exponentials is given byKalid Azad at http://betterexplained.com/articles/intuitive-understanding-o-sine-waves.

    Figure 18 - A sine wave as a summation o exponentials

    We see that a sine wave is the sum o a linear unction and then addition and subtractions o restoringorces in the opposite directions. Mathematically we see this in the ollowing power series equation o a

    sine wave.

    3 5 7

    sin( )3! 5! 7!

    x x xx x= + + (1.22)

    All these dierent representations o the Fourier Series are identical and mean exactly the same thing.

  • 7/29/2019 fft1

    12/23

    12Charan Langton, www.complextoreal.com

    How to compute the Fourier Coefcients o a wave

    In signal processing we are interested in spectral components o a signal. We want to know what thebandwidth is, and how the power is distributed over that bandwidth. When looking at a signal, we haveno idea what its components are. So ho can we go about assessing the signal? Fourier analysis gives us atool to do this. But Fourier analysis means breaking a signal down in harmonics. Real lie is not madeup o neat harmonics. So when we use Fourier analysis, we are deconstructing a signal into harmoniccomponents which is a sort o an approximation o reality and not its true representation.

    We are interested in knowing how many o the sines and cosines the target signal (Figure 5) canbe represented by and what their amplitudes are. Alternatively, what we really want are the Fouriercoefcients o the signal. Once we know the Fourier coefcients, we can draw the spectrum.

    Question: What is the relationship o Fourier coefcients to the spectrum?Te coefcients o the sine wave and the coefcients o the cosines, both represent the amplitudes

    and hence power o a particular harmonic.

    How do we compute the Fourier Coefcients? We will look at each o the three types o coefcientsseparately and see how they can be computed.

    Computing a0

    the dc coefcient

    0

    1

    1( ) ( sin cos )

    2n n n n

    n

    f t a f ta t b f

    =

    = + +(1.23)

    Te constant a0

    in the Fourier Equation represents the dc oset. It can also be called the bias. Butbeore we compute it, lets take a look at a useul property o the sine and cosine waves.

    Both sine and cosine wave are symmetrical about the x-axis. When you integrate a sine or a cosine waveover one period, you will always get zero. Te areas above the x-axis cancel out the areas below it. Tis isalways true over one period as we can see in the Figure 19.

    Figure 19 - Te area under a sine and a cosine wave over one period is always zero.

    Te same is also true o the sum o sine and cosines. Any wave made by summing sine and cosine wavesalso has zero area over one period. I we were to integrate the signal represented by the Fourier series overone period as in Equation (1.23), the area obtained will have to come rom the dc coefcient a

    0only. Te

    harmonics make no contribution and they all out.

    Positive and

    negative areacancel.

    Positive and

    negative areacancel.

  • 7/29/2019 fft1

    13/23

    13Charan Langton, www.complextoreal.com

    0

    0 1

    ( s) in cos

    TT

    o

    T

    n no

    n

    a nwt f t dt b nwt t a dt d

    =

    = +

    +

    (1.24)

    Te second term is zero in Equation (1.24), since it is just the integral o a wave made up o sine andcosines.

    Now we can compute a0

    by taking the integral o the arbitrary wave over one period.

    Figure 20 - Signal to be analyzed

    Figure 21a - Te dc oset o the signal

    Figure 21b - Signal without the dc component

    Te area under one period o this wave is equal to

    Te wave has non-zero areain one period, which means

    it has a DC ofset.

    Area under the wave whenshited down is zero.

    All area comes from the a0

    coefficient.

  • 7/29/2019 fft1

    14/23

    14Charan Langton, www.complextoreal.com

    0

    0

    ( )

    TT

    of t dt a dt= (1.25)

    Integrating this very simple equation we get,

    00

    ( )

    T

    f t dt a T= (1.26)

    We can now write a very easy equation or computing

    00

    1( )

    T

    a f t dt T

    = (1.27)

    Since no harmonics contribute to the area, we see that a0is equal to simply the area under the wave

    or one period. We can compute this area in sotware and i it comes out zero, then there is no dc oset.

    Computing na - the coefcients o sine waves

    Now we employ a slightly dierent trick rom basic trigonometry to compute the coefcients o thevarious sine waves. Below we show a sine wave that has been multiplied by itsel.

    Figure 22 - Te area under a sine wave multiplied by itsel is always non-zero.

    We notice that the wave now lies entirely above the x-axis and has net positive area. From integraltables we can compute this area as equal to

    0

    sin sin / 2

    T

    n na nwt nwt dt a T for n m= =(1.28)

    Now multiply the sine wave by an arbitrary harmonic o itsel to see what happens to the area.

    ( ) sin sinf t n t n t =

    Multiplying one sine wave

    by any other causes the areaunder the new wave to

    become zero.

  • 7/29/2019 fft1

    15/23

    15Charan Langton, www.complextoreal.com

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

    Te area in one period o a sine wave multiplied by its own harmonic comes out to be zero. Weconclude that when we multiply our signal by a particular harmonic, then integrate the product over oneperiod, the only contribution comes only rom that particular harmonic. All other harmonics contributenothing and all out. Writing this in integral orm,

    0

    0

    sin sin 0

    sin sin / 2

    T

    n

    T

    n n

    a nwt mwt dt for n m

    a nwt nwt dt a T for n m

    =

    = =

    (1.29)

    Multiply the signal by a certain harmonic, integrate and the result is equal to scaled coefcient o thatharmonic. We can do that n times, incrementing the harmonic requency, multiplying it by the signal,then integrating to get the amplitude o that harmonic hidden in the signal. Tis is essentially what aninverse Fourier transorm does.

    But the signal also has cosines in it too. Now lets multiply a sine wave by a cosine wave to see what

    happens.

    Figure 24 - Te area under a cosine wave multiplied by a sine wave is always zero.

    It seems that the area under the wave is always zero whether the harmonics are the same or not.Summarizing

    Sine wave multiplied by a cosinewave o any harmonic

    ( ) sin sinf t t n t =

  • 7/29/2019 fft1

    16/23

    16Charan Langton, www.complextoreal.com

    0

    0

    0

    sin sin 0

    sin sin / 2

    cos sin 0

    T

    n

    T

    n n

    T

    n

    a nwt mwt dt for n m

    a nwt nwt dt a T for n m

    a nwt mwt dt

    =

    = =

    =

    (1.30)

    Remember in vector representation sine and cosines are orthogonal to each other. Tis result tellsus something about the orthogonality o sines and cosines. We are basically taking a dot product here.Te dot product o a sine and cosine results in no area, hence the two signals are orthogonal. In act allharmonics are orthogonal to each other. Te dot product o two orthogonal waves is always zero whichcorroborates the above results. Another very satisying interpretation is that sine wave and cosine wavesact as ltering signals. In essence they act as a narrow-band lter and ignore all requencies except the oneo interest. Tis is the undamental concept o a lter.

    Now lets use this inormation. Successively multiply the Fourier equation by a sine wave o a particularharmonic and integrate over one period as in equation below

    00

    0 sin cos si( )sin sin s

    0

    in n

    T TT T

    nn

    o

    f t nwt dt a na wt dt b nwt nwt d wt nwt dt t= + + (1.31)

    We know that the integral o the rst and the third term is zero since the rst term is just the integralo a sine wave multiplied by a constant and the third is o a sine wave multiplied by a cosine wave. Tis

    simplies our equation considerably. We know that integral o the second term is

    0

    sin sin2

    T

    nn

    a Ta nwt nwt dt =

    (1.32)

    From this we write the equation to obtain na as ollows

    0

    2( ) sin

    T

    na f t nwt dt T

    = (1.33)

    Te coefcient na is hence computed by taking the target signal over one period, successivelymultiplying it with a sine wave o nth harmonic requency and then integrating. Tis gives the coefcientor that particular harmonic. I we do this n times, we will get n coefcients.

    Computing coefcient o cosines, bn

    Now instead o multiplying by a sine wave we multiply by a cosine wave. Te process is exactly thesame as above.

  • 7/29/2019 fft1

    17/23

    17Charan Langton, www.complextoreal.com

    0

    0

    0

    co( ) cos cs sin c os c s

    0

    oosT TT

    n

    T

    o

    na wt dt a nwf t nwt dt b nwt nwt dt nw t tt d= + + (1.34)

    Now terms 1 and 2 become zero. Te third terms as above is equal to

    0

    cos cos2

    T

    nn b Tb nwt nwt dt = (1.35)

    and the equation can be written as

    0

    2( ) cos

    T

    nb f t nwt dt T

    = (1.36)

    So the process o nding the coefcients is multiplying the target signal with successively largerharmonic requencies o a sine wave and integrating the results. Tis is easy to do in sotware. Te resultobtained is the coefcient or that particular requency o sine wave. We do the same thing or cosine

    coefcients.

    Lets look at the signal rom Figure 5. Here are the coefcients we used to create this signal.

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

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

    0a = .32

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

    . 4 sin .3sin2 .7sin3 .3sin4 .3sin5 .3sin6 .2sin7 .3sin8 .4sin9

    .05cos .2cos 2 .7cos3 .5cos4 .2cos5 .2cos6 .1cos7 .05cos8 .

    (

    01cos )

    32) ..(

    9t t t t t

    t t

    f

    t t t

    t t t t t

    t

    t

    t t

    t

    +

    + + + + + + + + +

    + + + +

    =

    + ++ + +

    (1.37)

    Conceptually the process o computing the coefcients consists o ltering the target signal onerequency at a time. In sotware when we compute the spectrum, this is exactly what we are doing. So thespectrum bins can be seen as tiny little lters.

    Summary

    Te Fourier series is given by

    01 1

    ( ) sin(2 ) cos(2 )N N

    n n n n

    n n

    f t a a f t b f t = =

    = + + (1.38)

    Te coefcients in the Fourier series are given by

    00

  • 7/29/2019 fft1

    18/23

    18Charan Langton, www.complextoreal.com

    00

    1( )

    T

    a f t dt T

    = (1.39)

    0

    2( ) sin

    T

    na f t nwt dt T

    = (1.40)

    0

    2( ) cos

    T

    nb f t nwt dt T

    = (1.41)

    Coefcients become the spectrum

    Now that we have the coefcients, we can plot the spectrum o this signal. Tis is a one-sided discretespectrum, a result o the Fourier series transormation.

    We plot or each harmonic, its coefcient. Both sines and cosines o same requency are plotted nextto each other.

    0

    0.1

    0.2

    0.3

    0.4

    0.5

    0.6

    0.7

    0.8

    1 2 3 4 5 6 7 8 9

    Sin

    Cos

    Figure 25 - Te Fourier series coefcients or each harmonic

    You may say that this spectrum is in terms o sines and cosines, and this is not the way we see it inbooks. Te spectrum ought to give just one number or each requency.

    We can compute that one number by knowing that most signals are represented in complex notation.Te total power shown on the y-axis o the spectrum is the power in both the sines and cosines. Ater allthey are o the same requency, just shited in phase. So we should be able to add their powers. Tis wecan compute by doing the root sum square o the sine and cosine coefcients. Now we plot the modied

    spectrum using a combined coefcient. Te new coefcient is

    2 2n n nc a b= + (1.42)

  • 7/29/2019 fft1

    19/23

    19Charan Langton, www.complextoreal.com

    0

    0.2

    0.4

    0.6

    0.8

    1

    1.2

    1 2 3 4 5 6 7 8

    Figure 23 - A traditional looking spectrum created rom the Fourier coefcients

    Voila! Although this is not a real signal, we see that it now looks like a traditional spectrum. Tey-axis can easily be converted to dB as is done or most spectrums. Te spectrum has 8 harmonics, so itsbandwidth is 7 Hz. Te peak power is at 3 Hz.

    In complex representation, the phase o the signal is dened by

    1tan ( / )n n nb a=

    (1.42)

    We could have plotted it too by just doing the above math or each harmonic. Phase plays a veryimportant role in signal processing and particularly in complex representation. However plotting phaseis not nearly as visually instructive. Most o the time, when talking about spectrums, phase is entirelyignored.

    One thing you may not have noticed about the computation o the coefcients is that they willbe dierent depending on what you pick as the start o the period. We do not see this aspect becausecalculating a spectrum requires us to root sum square the sine and cosine coefcients. Tis RSS additiono the two coefcients is always constant. So the starting point o the Fourier analysis becomes a non-issue. As long as the target signal is periodic, this is not a problem. We will get the same spectrum nomatter where we start.

    We have been saying that the wave has to be periodic. But with real signals we can never tell wherethe period is. No periodicity can usually be seen. In act, a real signal may not be periodic at all. In thiscase, we make an assumption. Te theory allows us to extend the period to innity so we just pick anysection o a signal or even the whole signal and call it Te Period, representing the whole signal. Tisassumption works just ne or most communications signals, i.e. signals that are steady-state and donthave transients.

    Figure 24 - We call the signal periodic, even though we dont know what lies at each end.

  • 7/29/2019 fft1

    20/23

    20Charan Langton, www.complextoreal.com

    Figure 25 - Our signal repeated to make it mathematically periodic, but ends do not connect and have discontinuity

    Te part o the signal that we pick as representing the real period is only a sample o the whole andnot really the actual period. So the ends o our chosen section may not match as they would or a realperiodic signal. Te error introduced into our analysis due to this end mismatch is called leakage. Teseerrors are also called aliasing. Windowing unctions are used to articially shape the ends so that ourchosen signal is orced to become periodic. But because this is essentially distorting the signal beore we

    can do an Fourier analysis on it, the results are not totally representative o reality. W will examine theissue o windowing in Chapter 3.

    Example 1: Show that this wave has only odd harmonics.

    Figure 26 - Computing coefcients o a square pulse

    Here is a signal with square pulses that last one-quarter o the period. Te amplitude is A. It is clearlooking at this signal that this is a symmetric signal so, we only need to calculate the coefcients o thecosines.

    rom this, when n is even, the value o the unction is zero. Hence the signal is composed onlyo odd harmonics.

    /8

    /8

    2 2cos

    22sin

    2 8

    sin2 4

    T

    nT

    nxb A dt

    T T

    A n T

    T

    A nc

    =

    =

    =

  • 7/29/2019 fft1

    21/23

    21Charan Langton, www.complextoreal.com

    Example 2: Find the coefcients o this wave.

    t

    T

    A

    Figure 27 - A saw-tooth wave

    Te wave is odd, so it only has sines.

    ( )

    /2

    / 2

    /22

    2 2 2

    /2

    2 2 2sin

    2 24 cos sin

    2 4

    2cos

    T

    nT

    T

    T

    tA nt a dt

    T T T

    A nt T T ntt

    T T n n T

    An

    n

    =

    = +

    =

    such that

    0

    1

    0

    2( 1)n

    n

    a

    Aa

    n

    +

    =

    =

    o be continued....

    Copyright 1998, 2012, All rights Reserved Charan Langton

    [email protected]

  • 7/29/2019 fft1

    22/23

    22Charan Langton, www.complextoreal.com

  • 7/29/2019 fft1

    23/23