discrete-time signals and fourier series...

Download Discrete-time Signals and Fourier series representationcomplextoreal.com/wp-content/uploads/2012/12/chapter-3.pdf · Chap 3 - Discrete-time Signals and Fourier series representation

If you can't read please download the document

Upload: vocong

Post on 06-Feb-2018

240 views

Category:

Documents


5 download

TRANSCRIPT

  • Chap 3 - Discrete-time Signals and Fourier series representation 1 | P a g e

    3 Discrete-time Signals and Fourier series representation

    In the previous two chapters, we discussed Fourier series analysis as applied to continuous-time signals. We saw that the Fourier series can be used to create an alternate representation of any periodic signal. This representation is done by summing sine and cosine functions or with complex exponentials of different amplitudes and phases. Both forms are equivalent. In the previous two chapters, our discussion was limited to continuous-time (CT) signals. In this chapter we will discuss Fourier series analysis as applied to discrete-time signals.

    Discrete signals are different from analog signals Although some signals are naturally discrete such as stock prices, number of students in a class etc. many electronic signals we work with are sampled from continuous signals. Examples of sampled signals are voice, music, and medical/biological signals. These signals are sampled, which means to measure their amplitude at fixed time intervals, at appropriate rates, to create a sampled version. Now-a-days, nearly everything that goes through a small electronic device can be assumed to be a discrete signal. However since not all signals are discrete by nature, the discrete signals are generated from analog signals by a process called sampling. This is also known as A/D conversion, and PCM. The generation of the discrete signal from an analog signal is done by an instantaneous sampling of the analog signal and creating an array of sampled voltages.

    Discrete vs. digital There are two very similar sounding concepts related to discrete signals. In general terms a discrete signal is continuous in amplitude but is discrete in time. This means that it can have any value whatsoever for its amplitude but is defined or measured only at a specific time. Hence the term discrete applies

  • Chap 3 - Discrete-time Signals and Fourier series representation 2 | P a g e

    to time and not to the amplitude. For purposes of Fourier analysis, we assume that the sampling is done at a constant interval of time between the samples. Hence it is time at which the signal is measured that is discrete and not necessarily the amplitude. A discrete signal is often confused with the term digital signal. Although in common language they are thought of as the same thing, a digital signal is a special type of discrete signal. Like general discrete signal, it is only defined at specific time intervals, but its amplitude is constrained to certain values. We have binary digital signals where the amplitude is limited to only two values,

    or . A M-level signal can take on just one of M pre-set

    amplitudes only. These are examples of discrete signals that have constrained amplitudes. Hence a digital signal is a specific type of discrete signal with constrained amplitudes. In this chapter we will be talking about general discrete signals which include digital signals. Both of these types of signals are called discrete-time (DT) signals. For all discrete signals, and that includes all digital signals, it is time that is always discrete. We call a general sampling time, the sampling instant.

    Figure 3.1 Here is an analog signal that is being sampled. Discrete sampling

    collects exact amplitudes at the sampling instant, whereas digital sampling rounds

    the values to the nearest allowed value. In (b), the sampling values are limited to

    just 2 values, +1 or -1. Hence, each value from (a) has been rounded to either a

    +1 or -1 to create a binary digital signal.

    We note that creation of a digital signal throws away some information. Hence it is an

    approximation of the discrete signal. This process can be thought of as resulting in

    signal-to-noise (SNR) degradation. This SNR degradation decreases as the number of

    allowed levels is increased and/or time between sampling instants is decreased. As the

    level increase, it is obvious that the levels are more likely to capture the true value.

    1, 1 0, 1

  • Chap 3 - Discrete-time Signals and Fourier series representation 3 | P a g e

    Generating discrete signals Often there is a need when doing math to distinguish between continuous-time (CT) and discrete-time (DT) signals. The convention is that a discrete-time signal is written with square brackets around the time index, n, whereas the continuous-time signal is written the usual way with round brackets around time index t. Here is how we write the continuous vs. the discrete signals.

    ( )

    [ ]

    x t Continuous

    x n Discrete

    The sample index n is a way of identifying a sample. If we start counting at 1 and n = 303, this means this is x[303] is the 303rd sample measured. The index n however does not imply any particular time. The real time is an independent quantity from the index and must be known in order to convert the index to real time. For example if each sample is measured every tenth of a second, then 30.3 seconds have elapsed at this point in the signal. This real time would change depending on the sampling speed, which we will define as the sampling frequency. In mathematics, we can create a discrete signal by multiplying a continuous signal with a comb-like sampling signal, as shown in Figure 3.2(b). The sampling signal shown in this figure is an impulse train but we will give it a generic name of p(t). We write the sampled function, sx as a function of

    continuous-time as the product of the continuous signal and the sampling signal.

    ( ) ( ) ( )sx t x t p t (3.1)

  • Chap 3 - Discrete-time Signals and Fourier series representation 4 | P a g e

    Figure 3.2 A continuous-time signal sampled at uniform intervals Ts with an

    ideal sampling function. The discrete signal in (c) [ ]x n consists only of the discrete

    samples and nothing else. The continuous signal is shown in dashed line for

    reference only. The receiver has no idea what it is. All it sees are the samples.

    The time between the samples, or the Sampling time is referred to as sT , and

    the Sampling frequency or rate is defined as the inverse of this sample time.

    Ideal sampling

    Lets assume that for p(t) we use an impulse train with period sT . Multiplying

    the impulse train with the signal, as in Eq. (3.1) we get a continuous signal with non-zero samples of the signal at discrete-time sample points, referred to by nTs. Hence for a continuous signal, the absolute time is the ordinal sample number times the time in between each sample. For the discrete signal, the sample interval is dropped and we only talk about n, the sample number. The sample time sT , becomes an independent parameter. Hence if we have two

    discrete signals with exactly the same sample values, are the signals identical? No, because the sampling time may be different. For a signal sampled with sampling function, p(t), an impulse train, we write the sampled signal per Eq. (3.1) as

    ( ) ( ) ( )s sn

    x t x t t nT

    (3.2) p(t)= d(t -nT

    s)

    n=-

  • Chap 3 - Discrete-time Signals and Fourier series representation 5 | P a g e

    The continuous signal (underlined) can be brought into the summation by

    changing its argument to snT , as shown in Eq. (3.3). The result is then a

    discrete-time signal, defined only by its samples. Note we write the discrete signal in square brackets. N is the total number of samples collected.

    0

    [ ] ( ) ( )N

    s sn

    x n x nT t nT

    (3.3)

    The term with round brackets is considered continuous since it is just

    the value of the continuous-time signal at time nTs. The term however is

    discrete, because the index n is integers by definition. The discrete signal

    has values only at points st nT where n is the integer sample number. It is

    undefined at all non-integers unlike the continuous-time signal. The sampling time sT relative to the signal frequency determines how coarse or fine the

    sampling is.

    Reconstruction of the original analog signal from discrete samples Why do we sample? We sample a signal for one main reason, to reduce its bandwidth. The other benefit we get from sampling is that often the signal processing on digital signals is easier. However, once sampled, processed and transmitted, this signal must then be converted back to its analog form. The process of reconstructing a signal from its discrete samples is called interpolation. This is the same thing we do when we plot a function. We compute a few values at some selected points and then connect those points to plot the representation of the function. The reconstruction by machines however is not as straight forward and requires giving them an algorithm consisting of math that they are able to do. This is where things get complicated. First of all, we note that there are two conditions for ideal reconstruction. One is that the signal must have been ideally sampled to start with, i.e. by an impulse train such that the sampled values represent the true amplitudes of the signal. Ideal sampling is hard to achieve but for our purposes, we will assume it can be done. The second is that the signal must not contain any frequencies above half of the sampling frequency. This second condition can be met by first filtering the signal by an anti-aliasing filter, a filter with a cutoff frequency that is half the sampling frequency prior to sampling. Or we assume that the sampling

    sx nT

    x n

    x n

  • Chap 3 - Discrete-time Signals and Fourier series representation 6 | P a g e

    frequency chosen is large enough to encompass all the important frequencies in the signal. Lets assume this is done also. Mathematically, the reconstruction process requires the use of the convolution function. In intuitive sense, think of convolution as a form of smearing of one function by another. In Fig. 3.3 we show the result of two convolutions. In (a) we convolve a narrow square pulse (made up of three impulses) with a square pulse. The result is a slightly distorted shape in column 3. In (b) we do the same thing but with a single impulse, (which is representation of ideal sampling) the result is no distortion, we get the same signal, which is now relocated at the impulse time. Here we show only one impulse, but imagine a whole train of these, repeating this process at every snT seconds, a process

    represented by the convolution of the shape function with an impulse train. In frequency domain, convolution can be thought of as low-pass filtering. Hence the reconstruction process in frequency domain involves filtering the signal, however for rest of the discussion we will stay in time domain instead.

    Figure 3.3 Convolving a shape with an impulse function moves the shape

    unchanged to a new location.

    For the purposes of reconstruction, we chose an arbitrary pulse shape, h(t). The idea is that we will replace each discrete sample with this pulse shape, and we are going to do this by convolving the pulse shape with the sampled signal. We write the sampled signal (in parenthesis) convolved with the an arbitrary shape, h(t) as

    ( ) ( ) ( ) * ( )r s sn

    x t x nT t nT h t (3.4)

    The index r indicates that this is a reconstructed signal. At each sample n, we multiply the sample (a single value) by h(t) (a little wave of some sort lasting

  • Chap 3 - Discrete-time Signals and Fourier series representation 7 | P a g e

    some time). This convolution in Eq. (3.4) centers the little wave at the sample location. All these arrayed waves are then added in time. (Note that they are in continuous-time.) Now depending on the h(t) or the little wave selected, we will get a reconstructed signal which may or may not be a good representation of the original signal.

    Simplifying this equation by completing the convolution of ( )h t with the

    impulse train, we write this somewhat simpler equation for the reconstructed signal.

    ( ) ( ) ( )r s sn

    x t x nT h t nT

    (3.5)

    To examine the possibilities for shapes, h(t), we pick the following three; a rectangular pulse, a triangular pulse and a sinc function. It turns out that these three pretty much cover most of what is used in practice. Each of these shapes has a distinctive frequency response as shown in Fig. 3.4. We use the frequency response to determine the effect these shapes will have on the reconstructed signal.

    Figure 3.4 - We will reconstruct the analog signal by replacing each sample by one

    of these shapes on the left: rectangular, triangular or the complicated looking sinc

    function. Each has a distinct frequency response as shown on the right.

    Case 1: Zero-order hold Fig. 3.4(a) shows a square pulse. The implication is that we will replace each sample with a square pulse of amplitude equal to the sample value. This basically means that the sample amplitude is held to the next sampling instant in a flat line. The hold time period is sT . This form of reconstruction is called

  • Chap 3 - Discrete-time Signals and Fourier series representation 8 | P a g e

    sample-and-hold or zero-order-hold (ZOH) method of signal reconstruction. Zero in ZOH is the slope of the interpolation function, a straight line of zero slope connecting one sample to the next. We may think this as a simplistic method but if done with small enough resolution, that is a very narrow rectangle in time, it can do a decent job of reconstructing the signal. The shape function h(t) in this case is a rectangle.

    ( ) ( )sh t rect t nT (3.6)

    The reconstructed signal is now given using the general expression of Eq. (3.4), where we substitute the [rect] shape into Eq. (3.5).

    [n] ( ) ( )r s sn

    x x nT rect t nT (3.7)

    We show the index as going from [ ]n as the general form. In Fig. 3.5(a), we see a signal reconstructed using a ZOH circuit. From the convolution property, the shape is now repeated at each sample.

    Figure 3.5 A zero-order-hold method of reconstructing the original analog

    signal. This method results in a stair-step reconstruction. If sample time, Ts is

    small compared to the period of the analog signal, the reconstruction can be

    pretty good.

    Case 2: First order hold (linear interpolation) In this case, we replace each sample with a little pulse shape that looks like a triangle of width 2 sT as given by the expression

    1 / 0

    ( ) 1 / 2

    0

    s s

    s s s

    t T t T

    h t t T T t T

    else

    (3.8)

  • Chap 3 - Discrete-time Signals and Fourier series representation 9 | P a g e

    This function is shaped like a triangle and the reconstructed signal equation from Eq. (3.5) now becomes

    [n] ( ) ss sn s

    t nTx x nT tri

    T (3.9)

    We see how in Fig. 3.6(b) that now instead of non-overlapping rectangles, we have overlapping triangles. Thats because we set the width of the triangle as twice the sample time. This double-width does two things; it keeps the power the same as the case of the rectangle and it fills the in-between points in a linear fashion. This is method is called a linear interpolation as we are just connecting the points. This is called the First-order-hold (FOH) because we effectively we are connecting the adjacent samples with a line of linear slope. Why you may ask use triangles when we can just connect the samples? Machines cannot see the samples nor connect the samples. Addition is about all they can do well. Hence this method replaces linear interpolation as you and I might do visually with a simple addition of displaced triangles. It also gives us a hint as to how we can use any shape we want and in fact of any length, not just two times the sample time! This does introduce the idea of non-causality since the shape of the sample is now going back into the past, but we can deal with this.

    Figure 3.6 A First-order-hold (FOH) method of reconstruction by replacing each

    sample with a triangle of the same amplitude but twice the sample time width.

    The summation of overlapping triangles results in a signal that appears to linearly

    connect the samples.

    Case 3: Sinc interpolation We used triangles in FOH and that seems to produce a better looking reconstructed signal than ZOH. We can in-fact use just about any shape we want to represent a sample, from the rectangle to one composed of a complex shape, such as a sinc function. A sinc function seems like an unlikely choice since it is non-causal (as it extends into the past) but it is in-fact an extension of the idea of the first two methods. Both zero-order and first-order holds are forms of polynomial curve fit. The first-order is a linear polynomial, and we

  • Chap 3 - Discrete-time Signals and Fourier series representation 10 | P a g e

    continue in this fashion with second-order on up to infinite orders to represent just about any type of wiggly shape we can think of. A sinc function is an infinite order polynomial and is the basis of perfect reconstruction. The reconstructed signal becomes a sum of scaled, shifted sinc functions same as triangular shape. Even though the Sinc function is an infinitely long function, it is zero-valued at regular intervals. This interval is set as the sampling period. Since each sinc pulse lobe crosses zero at only the sampling instants, the summed signal where each sinc is centered at a different n adds no interference to other sinc pulses centered at other times. Hence this shape is considered to be free of inter-symbol interference (ISI).

    Figure 3.7 - Reconstructing a signal using sinc functions. We show four sinc

    functions added together to reconstruct this discrete signal from its four samples.

    Note that they all cross zero at all sampling instants other than where they are

    centered. So one sinc pulse does not add anything to the adjacent pulse. The

    reconstructed signal is now smoothly varying with exactly correct amplitudes at

    each sampling instant.

    The equation we get for the reconstructed signal in this case is similar to the first two cases, with the reconstructed signal summed with each sinc located

    at snT .

    ( ) sinc

    [n] ( )sinc

    s

    r s sn

    h t t nT

    x x nT t nT (3.10)

  • Chap 3 - Discrete-time Signals and Fourier series representation 11 | P a g e

    Dealing with non-causality If we start at n = 0, and we need to represent a sample by a sinc shape that extends 8 samples in the past and 8 in future, then the first 8 samples will incorrectly represented. Hence in real signals, some non-informational starting bits are used to get the process started and these are later discarded. In Fig. 3.8 we see this process for a longer signal, with each sample being replaced by a sinc function and the resulting reconstructed signal is compared to the original signal.

    Figure 3.8 Reconstruction with Sinc pulses means replacing the sample with a

    scaled sinc function. The original signal in (c) has been shifted slightly

    (artificially) so you can see how good of a job the sinc function does. It has

    reconstructed the original analog signal from its n samples in (a) perfectly.

    Clearly we can see that the sinc construction does a very good job. How to tell which method is better? Clearly ZOH has done a rather hatchet of a job. But to properly assess these methods requires the full understanding of the Fourier Transform, a topic yet to be covered in Chapter 4. So we will drop this subject now with recognition that a signal can be perfectly reconstructed using the linear superposition principal using many different shapes, with sinc function being one example, albeit a really good one, the one we call the perfect reconstruction.

  • Chap 3 - Discrete-time Signals and Fourier series representation 12 | P a g e

    The sinc function detour We will be coming across the sinc function a lot. It is absolutely the most useful and most used piece of mathematical concept in signal processing. Hence we examine the sinc function in a bit more detail now. In Fig. 3.9, we see the function plotted in time-domain by Matlab. This form is called the normalized sinc function. It is a continuous function of time, t and is not periodic. This form of continuous-time sinc function is given by

    1 0

    ( ) sin( )0

    t

    h t tt

    t

    (3.11)

    At the origin its value is set to 1.0. As we see from this equation, the function is zero

    for all integer values of t, because in such case the sine of an integer multiple of is

    zero. In Matlab this function is given as: sinc(t). No is needed as it is already

    programmed in. The Matlab plot would yield first zero crossing at 1 and as such the width of the main lobe is 2 units. We can create any main lobe width by inserting

    a variable Ts into the equation Eq. (3.12). The generic sinc function of lobe width Ts

    (main lobe width = 2 Ts ) is given by

    sin( )( ) s

    s

    t Th t

    t T (3.12)

    Figure 3.9 The sinc function in time-domain. The signal is non-periodic.

    Its peak value is 1 for the normalized form. Note that the main lobe of the

    sinc function spans two times the parameter Ts . in (b) we plot the

  • Chap 3 - Discrete-time Signals and Fourier series representation 13 | P a g e

    absolute value of this function so the lobes on the negative side have

    flipped to the top.

    Fig. 3.9 shows this function for two different times, 2sT and 1sT (same

    as the normalized case.) The sinc function is often plotted in the second style as in Fig. 3.9(b) with amplitudes shown as absolute values. This style makes it easy to see the lobes and the zero crossings. It is the preferred style in frequency domain, but not in time domain. Note that the function has a main lobe that is 2 times sT seconds wide. All the other lobes are sT seconds wide.

    The sinc function has some interesting and very useful properties. First one is that its integral is equal to 1.0.

    sin (2 / ) (0) 1sc t T dt rect

    The second interesting and very useful property, from Eq. (3.12) is that as sT

    decreases, the sinc function approaches an impulse. This is of course obvious from Fig. 3.9. A smaller value to Ts means a narrower main lobe. Narrow main lobe makes the central part impulse-like and hence we note that as

    0sT goes to zero, the function approaches the Kronckers delta function.

    From that we get that a group of uniformly located sincs would approach an impulse train. In discrete-time, we say that a sinc function when sampled at integer arguments, is exactly the same as a delta function. Another interesting property is that the sinc function is equivalent to the summation of all complex exponential. This is a magical property in that it tells us how Fourier transform works by scaling these exponentials.

    1

    sinc(t)2

    j te d (3.13)

    This property is best seen in Fig. 3.10, which shows what we get when add 90 harmonic complex exponentials together. The signal looks very much like an impulse train.

    Figure 3.10 In this figure we add 90 consecutive harmonics (f = 1, 2, 90), and

    what we get looks very nearly like an impulse train.

  • Chap 3 - Discrete-time Signals and Fourier series representation 14 | P a g e

    The sinc function, as we shall see later is also the frequency response to a square pulse. We can say that it is a representation of a square pulse in the frequency domain. If we take a square pulse (also called a rectangle, probably a better name anyway) in time domain, then its Fourier series representation will be a sinc, alternately, if we take a time domain sinc function as we are doing here, then its frequency representation is a rectangle, which says that it is tightly limited in bandwidth.

    Sampling rate How do we determine what is an appropriate sampling rate? In Fig. 3.11 we show an analog signal sampled at two different rates, in (a) the signal is sampled slowly and in (b) sampled rapidly. At this point, our idea of slow and rapid is arbitrary.

    Figure 3.11 The sampling rate is an important parameter, (a) analog signal

    sampled probably too slowly, (b) probably too fast.

    It is obvious by looking at the samples in Fig. 3.10(a) that the rate is not quick enough to capture all the ups and downs of the signal. Some high and low points have been missed. But the rate in Figure 3.10(b) looks like it might be too fast as it is capturing more samples than we may need. Can we get by with a smaller rate? Is there is an optimum sampling rate that captures just enough information such that the sampled analog signal can still be reconstructed faithfully from the discrete samples?

    Shannons Theorem There is an optimum sampling rate. This optimum sampling rate was established by Harry Nyquist and Claude Shannon and others before them. But the theorem has come to be attributed to Shannon and is called the Shannons Theorem. Although Shannon is often given credit for this theorem, it has a long history. Even before Shannon, Harry Nyquist (a Swede who immigrated to USA in 1907 and did all his famous work in the USA) had

  • Chap 3 - Discrete-time Signals and Fourier series representation 15 | P a g e

    already established the Nyquist Rate. Shanon took it further and applied the idea to reconstruction of discrete signals. And even before Nyquist, the sampling theorem was used and specified in its present form by a Russian scientist by the name of V. A. Kotelnikov in 1933. And even he may have not been the first. So simple and yet so profound, the theorem is very important in all types of signal processing. The theorem says: For any analog signal containing among its frequency content a maximum

    frequency of , then the analog signal can be represented faithfully by N

    equally spaced samples, provided the sampling rate is at least two times

    samples per second. Although the theorem is named after Shannon, the sampling frequency is

    called by Nyquists name. We define the Sampling frequency, as the

    number of samples collected per second. For a faithful representation of an

    analog signal, the sampling rate must be equal or greater than two times

    the maximum frequency contained in the analog signal. We write this rule as

    (3.12)

    The Nyquist Rate is defined as the case of sampling frequency exactly

    equal to 2 times . This is also called the Nyquist threshold.

    is defined as the time period between the samples, and is the inverse of the

    sampling frequency, .

    Figure 3.11 There is no relationship between the sampling period and the

    fundamental period of the signal. They are independent quantities.

    maxf

    maxf

    sF

    sF

    2s maxF f

    sF

    maxf

    sT

    sF

  • Chap 3 - Discrete-time Signals and Fourier series representation 16 | P a g e

    A practical signal will have many frequencies. In setting up the Fourier series

    representation, we define the lowest of all its frequencies, as its

    fundamental frequency. The fundamental period of the signal, is the

    inverse of the fundamental frequency as we defined this in chapter 1.

    The maximum frequency, contained within the signal is used to

    determine an appropriate sampling frequency for the signal, . An

    important thing to note is that the fundamental frequency, is not related

    to the maximum frequency of the signal. Hence there is also no relationship

    whatsoever between the fundamental frequency, of the analog signal and

    the sampling frequency, picked to create a discrete signal from the analog

    signal. The same is true for the fundamental period, of the analog signal

    and the sampling period . They are not related either. This point can be

    confusing. is a property of the signal, whereas is something chosen

    externally for sampling purposes. The Shanon theorem applies strictly speaking to baseband signals or what we call the low-pass signals. There is a complex-envelope version where even though the center frequency of a signal is high due to having been modulated, the signal can still be sampled at twice its bandwidth and be perfectly reconstructed. This is called the band-pass sampling theorem. We wont discuss it here.

    Frequency confusion of sampled discrete signal In Fig. 3.12 (a) we see some discrete samples and in (b) we see that these points could have come from any of the waves shown that pass through those same points. In reconstruction, we ask ourselves, which of these waves did these samples actually come from? This is a conundrum that is always present with discrete samples unless we know something about the signal ahead of time. Thankfully since the signals are not coming from outer space or from an unknown source, we often do know something about them. We know the approximate range of the frequency transmitted and hence can narrow down the range of possibilities.

    0f

    0 T

    maxf

    sF

    0f

    0f

    sF

    0T

    T

    s

    0T T

    s

  • Chap 3 - Discrete-time Signals and Fourier series representation 17 | P a g e

    Figure 3.13 - Three signals of frequency 1, 3 and 5 Hz all pass through the same

    discrete samples shown in (a). How can we tell which frequency was transmitted?

    The samples in Fig. 3.13(a) could have come from any of these three signals. In fact, they could have come from an infinite number of others which are not shown. This is a basic and very important ambiguity of the discrete signals. This effect that many different frequencies can be mapped to the same samples is called aliasing. This effect underlies all the other confusions we will see when computing the spectrum of discrete signals. Later we will discuss how the spectrum of a discrete signal repeats, and it repeats precisely for this reason that we do not know the real frequency of the signal, so the result, the Fourier representation, gives us all the possibilities. In Fig. 3.14(b), we see the spectrum of a signal in (a) and we see that the spectrum seems to repeat with regularity. This repeating spectrum is a consequence of the discrete signal frequency ambiguity.

    Figure 3.14 When a continuous signal is sampled with a given sampling

    frequency, the spectrum repeats with that same sampling frequency. In (a), the

    samples were obtained by sampling the signal with Fs = 20 samples per second,

    and we see in (b) the spectrum repeating with 20 Hz. This a consequence of

    frequency ambiguity.

  • Chap 3 - Discrete-time Signals and Fourier series representation 18 | P a g e

    Lets examine a signal of frequency 5 Hz, sampled at a rate of 8 samples per second as in in Fig. 3.15(a). When the reconstruction is done using sinc functions, we see get a signal of 3 Hz. Clearly this is wrong since we already know the answer. It should have been 5 Hz. We used sinc to reconstruct the signal (which we said is an ideal reconstruction) and we still got the wrong answer. How can that be?

    Figure 3.16 A 5 Hz signal sampled at 8 samples per second is reconstructed using

    sinc reconstruction. The reconstructed signal passes through all the samples

    without error but is of the wrong frequency.

    Before we look into the reason, lets give a name to these frequencies that can fit through the same points. These are called aliases. An alias is an alternate representation of something that is also valid. Like an equation with many roots, all these frequencies are theoretically correct representation but in practice of course not what we want. Just as we can ignore all possible but out-of-range roots of an equation, we do the same here. These aliases are equivalent to many roots of an equation. The correct set of frequencies (which we call the spectrum) are called the principal alias, the desired one, the correct one. This ambiguity is caused by the chosen sampling rate which is inadequate. In Fig. 3.16 we look again at the same signal of frequency 5 Hz from Fig. 3.15, but now sampled at 16 samples per second, instead of at 8 samples per second.

  • Chap 3 - Discrete-time Signals and Fourier series representation 19 | P a g e

    Figure 3.16 A signal sampled at 16 samples per second is reconstructed, since

    there so many aliases that fit the same samples, which frequency is the correct

    one? Is the one with lowest frequency the correct one? In the first case we see 5/4

    or 1.25 cycles of the signal, in the second case we see 11/4 = 2.25 cycles, the third

    we see 27/4 = 6 3/4 cycles etc.

    On receiving the samples, the D to A converter, like a good mathematician does a thorough search and gives us several choices. The offered guesses are: 5, 11, 19, 27, 49 Hz etc. This time we see that 5 Hz signal is indeed one of the choices. In fact it is the lowest one. We do not see a 3 Hz signal as a choice at all. Why 3 Hz appeared as a choice when sampled at 8 samples per second (samps) but not when sampled at 16 samps, we shall now see. In Fig. 3.15 the sample rate is 8 samps and in Fig. 3.15, it is 16 samps. In the second case the sample rate is larger than 10 Hz which is two times 5 Hz, and hence above the Nyquist threshold. At this sampling rate, the original frequency is revealed to be first solution. All the aliases are higher in frequency than the original. However, in the case of sampling at 8 Hz, we see that the lowest alias is not the actual signal. When this happens we can no longer definitively identify the original frequency. The threshold for the 5 Hz sine wave is a sampling rate of 10 Hz. Below this rate, aliases will appear below the original 5 Hz and fool the reconstruction process. From this we recognize the usefulness of the famous theorem: if an analog signal is sampled at least twice the signal frequency, the D to A converter will pick the actual frequency as one the possible choices. In fact it will be lowest one of all the choices. The sampling frequency chosen must be higher than the Nyquist rate, else we will get the wrong answer.

  • Chap 3 - Discrete-time Signals and Fourier series representation 20 | P a g e

    What actually happens when you under-sample

    If a sinusoidal signal of frequency (since a sine wave only has one

    frequency, both its highest and its lowest frequencies are the same.) is

    sampled at less than two times the maximum frequency, , then the

    signal that is re-constructed is not the same signal at all. The expression for all the aliases that can result for such a signal is given by

    (3.13)

    Here m is a positive integer satisfying this equation.

    0( ) 2s sf mF F

    This equation is a very important but it is not intuitive. So lets take a look at an example. Example 3.1

    Take the signal with 0f = 5 Hz and sF = 8 Hz or samps. We use Eq. (3.13) to

    find the possible aliases. Here are first three (m = 1, 2, 3) aliases.

    The first three alias frequencies are 3, 11, and 19 Hz, all varying by 8 Hz, the sampling frequency. The significance of m, the order of the aliases is as follows. When the signal is reconstructed, we again need to filter it by an anti-aliasing filter to remove all higher order aliases. Setting m =1 implies the filter is set at frequency of mFs/2 or in this case 4 Hz. For m = 2, the filter would be set at Fs = 8 Hz. Now typically this filter is set to half of the sampling frequency. So we only see the frequencies that fit those samples below this number. Higher order aliases although present are filtered out. Figure 3.17 which is a spectrum of the reconstructed signal shows the Eq. (3.13) in action. Each m in Eq. (3.13) represents a shift. For m = 1, the cutoff point is 4 Hz, which only lets one see the 3 Hz frequency but not 11 Hz or higher. Note the first set of components are at 3 Hz from the center.

    0f

    02sF f

    0( ) (2 ( )sy t sin f mF t

    1: ( ) sin(2 (5 1 8) ) sin(2 3 )

    m 2 : ( ) sin(2 (5 2 8) ) sin(2 11 )

    m 3: ( ) sin(2 (5 3 8) ) sin(2 19 )

    m y t t t

    y t t t

    y t t t

  • Chap 3 - Discrete-time Signals and Fourier series representation 21 | P a g e

    Figure 3.17 - The spectrum of the signal repeats with sampling frequency of 8 Hz.

    Only the 3 Hz signal is below the 5 Hz cutoff.

    The fundamental pair of components are at +5 and -5 Hz. Now per the property from Eq. (3.12), this spectrum (the bold pair of impulses at 5 Hz

    repeat with a sampling frequency of 8 Hz. Hence the first move of the pair centered at 0 Hz is now centered at 8 Hz (dashed lines). The lower component falls at 8 - 5 = 3 Hz and the upper one at 8 + 5 = 13 Hz. The second shift centers the components at 16 Hz, with lower component at 16 5 = 11 Hz and the higher at 16+5 = 21 Hz. The same thing happens on the negative side. All of these are called alias pairs. They are all there unless the signal is filtered to remove these.

    What happens when you do not under-sample The sampling theorem states that you must sample at twice the frequency of maximum frequency in the signal in order to properly reconstruct the signal from the samples. We saw that the consequence of not doing that is that we get aliases from Eq. (3.12) at wrong frequencies. But what if we do sample at twice or greater rate. Does that have an effect and what is it? Example 3.2

    .2sin(2 ) sin(4 ) .7cos(6 t) .4cos(8 t)x t t

    Lets take this signal as shown in Fig. 3.18(a). The highest frequency is 4 Hz. But we are told that the amplifier has a non-linearity which spreads the signal a bit. So just to be on the safe side we sample this signal at 10 Hz and then to be really safe, we sample it again at 16 Hz. The spectrum as computed by the Fourier series coefficients (FSC) of the 4 frequencies in this signal is shown in Fig. 3.19(b). (We have not yet discussed how to compute this discrete spectrum, but the idea is exactly the same as for the continuous-time case.) For discrete signals, the Fourier series coefficients repeat with integer multiple

    of the sampling frequency sF . The entire spectrum is copied and shifted to a

    new center frequency to create an alias spectrum. This continues forever on

  • Chap 3 - Discrete-time Signals and Fourier series representation 22 | P a g e

    both sides of the principal alias, shown in a dashed box in the center in Fig. 3.17.

    Figure 3.18 A composite signal of several sinusoid is sampled at twice the highest

    components. In (b), we see the discrete coefficients (what we call the spectrum)

    repeating with the sampling frequency.

    Figure 3.18 shows several alias spectrums for the signal when sampled at 10 Hz. The spectrum itself is only 8 Hz wide so there is no overlap but the spectrums are very close together. In Fig. 3.19, we see the same signal sampled at 16 Hz, and we see that there is plenty of distance between the spectrums. Lowering the sampling rate decreases the spacing between the alias spectrums. The replications would start to overlap if they are not spaced far enough apart. If this were to happen we would not be able to separate one replication from another, making the original signal impossible to reconstruct. When non-linearities are present, the sampling rate must be higher than Nyquist threshold to allow the spectrum to spread and not overlap. The same is true for the effect of the roll-off from the anti-aliasing filter. Since practical signals do not have sharp cutoffs, some guard band has to be allowed. This guard band needs to be taken into account when choosing a sampling frequency.

  • Chap 3 - Discrete-time Signals and Fourier series representation 23 | P a g e

    Figure 3.19 The higher the sampling frequency, the further apart are the

    replications of the spectrum.

    If the spectrums do alias or overlap, the effect cannot be gotten rid of by filtering. Since we do not a-priori have knowledge of the signal spectrum, we are not likely to be aware of any aliasing if it happens. We always hope that we have correctly guessed the highest frequency in the signal and hence pick a reasonably large sampling frequency to avoid this problem. However, usually we do have a pretty good idea about the target signal frequencies. We allow for uncertainties by sampling at a rate that is higher than twice the maximum frequency, and usually much higher than twice this rate. For example, take audio signals which range in frequency from 2020,000 Hz. When recording these signals, they are typically sampled at 44.1 kHz (CD), or 48 kHz (professional audio), or 88.2 kHz, or 96 kHz rates depending on quality desired. Signals subject to non-linear effects spread in bandwidth after transmission and have sampling rates of 4 to 16 times the highest frequency to cover the full spread signal.

    Discrete signal parameters There are important differences between discrete and analog signals. An analog signal is defined by parameters of frequency and time. To retain this analogy of time and frequency for discrete signals, we use n, the sample number as the unit of discrete-time. The frequency however gives us a problem. If in discrete-time, time has units of sample, then the frequency of a discrete signal must have units of radians per sample. The frequency of a discrete signal is indeed is a different type of frequency than the traditional frequency of continuous signals. We call it Digital

    Frequency and use the symbol to designate it. We can show the equivalence of this frequency to the analog signal by noting how we write the two forms of signals.

    http://en.wikipedia.org/wiki/Compact_dischttp://en.wikipedia.org/wiki/Professional_audio

  • Chap 3 - Discrete-time Signals and Fourier series representation 24 | P a g e

    0

    0

    Analog : ( ) sin(2 )

    Discrete : [ ] sin(2 )s

    x t f t

    x n f nT

    The first expression is a continuous signal and the second a discrete signal. For the discrete signal, we replace continuous-time, t with snT . Alternately we

    can write the discrete signal as in Eq. (3.14) by noting that the sampling time is inverse of the sampling frequency. (We always have the issue of sampling frequency even if the signal is naturally discrete and was never sampled from a continuous signal. In such a case, the sampling frequency is just the inverse of the time between the samples.)

    02

    x[n] sins

    fn

    F (3.14)

    Digital frequency of discrete signals

    Now define the Digital frequency, by this expression.

    02

    s

    f

    F (3.15)

    Substitute this definition of digital frequency into Eq. (3.14) and we get [ ] sin( )x n n

    Now we have two similar looking expressions for a sinusoid, a discrete and a continuous form.

    (3.15)

    The digital frequency is equivalent in concept to th analog frequency , but these two frequencies have different units. The analog frequency has units of radians per second whereas the digital frequency has units of radians per sample. We define the fundamental period of a discrete signal as a certain number of

    samples, which we will write as This is equivalent in concept to the

    fundamental period of an analog signal, . A discrete periodic signal is

    ( ) sin

    [ ] sin

    x t t

    x n n

    0N

    T

    0

  • Chap 3 - Discrete-time Signals and Fourier series representation 25 | P a g e

    defined as repeating after some number of samples. In the continuous

    domain, a period represents 2 radians. To retain equivalence in both

    domains, the samples hence also cover radians, from which we have

    this relationship.

    (3.16)

    The units of 0 are radians/sample and units of 0N are just samples. To be

    periodic we want the result to be 2 or an integer multiple of2 . The digital frequency is a measure of the number of radians the signal moves per sample. And when we multiply it by the fundamental period 0N , we get an integer

    multiple of 2 .

    Figure 3.20 A discrete signal in time domain can be referred to by its

    sample numbers, n (1 to N) or by the digital frequency phase advance.

    Each sample advances the phase by 2 N radians. In this example, N is 8. In

    (a), the x-axis is in terms of real time. In (b) it is in terms of sample

    identification number or n. In (c) we note the radians that pass between

    each sample such that total excursion over one period is 2 .

    There are three ways to specify a sampled signal. In Figure 3.19(a), we show two periods of a signal. This is a continuous signal, hence the x-axis is continuous-time, t. Now we sample this signal. Each cycle is sampled with eight samples, so we show a total of 17 samples, numbered from -8 to +8 in Fig. 3.17(b). This is the discrete representation of signal x(t) in terms of samples which are identified by the sample number, n. This is a one way of showing a discrete signal. Each sample has a number to identify it. A periodic signal is said to cover 2 radians in one cycle. We can replace the sample number with a phase value for an alternate way of showing the discrete signal. In Fig. 3.19, there are 8 samples over each 2 radians or

    0N

    0N 2

    0 0 2N

  • Chap 3 - Discrete-time Signals and Fourier series representation 26 | P a g e

    equivalently a discrete angular frequency of 2 8 radians per sample. This is

    the digital frequency, 0 that is pushing the signal forward by this many

    radians. Each sample moves the signal further in phase by / 4 radians from

    the previous sample, with two cycles or 16 samples covering 4 radians. Hence we can label the samples in radians. Both forms, using n or the phase are equivalent but the second form is more common for discrete signals in text books, but tends to be more confusing and non-intuitive.

    Are discrete signals periodic? Fourier series representation requires that the signal we are subjecting to Fourier representation be periodic. So can we assume that a discrete signal since it is sampled from a periodic signal is also periodic? The answer is strangely enough, No. Here we look at the conditions of periodicity for a continuous and a discrete signal.

    : ( ) ( )

    : [ ] [ ]

    Continuous x t x t T

    Discrete x n x n N (3.17)

    This expression says that if the values of a signal repeats after a certain number of samples, N for the discrete case and a certain period of time T for the continuous case, then the signal is periodic. The smallest value of N that satisfies this condition is called the fundamental period of the discrete signal. Since we use sinusoids as basis functions for Fourier analysis, lets apply this general condition to a sinusoid. To be periodic, a discrete sinusoid which is defined in terms of the digital frequency and time sample n, must repeat after N samples, hence it must meet this condition.

    0 0cos cosn n N (3.18)

    We expand Eq. (3.18) to examine under which condition the expression is true.

    0 0 0 0 0cos ( ) cos( )cos( ) sin( )sin( )n N n N n N (3.19)

    For this expression to be true, we first need the underlined parts on the RHS to be equal to 1 and 0.

    0 0 0 0 0

    1 0

    cos cos( )cos( ) sin( )sin( )n n N n N (3.20)

  • Chap 3 - Discrete-time Signals and Fourier series representation 27 | P a g e

    For these two conditions to be true, we must have

    0

    0

    2

    2

    N k or

    k

    N

    (3.21) We conclude that a discrete sinusoid is periodic if its digital frequency is a rational number multiple of 2 . This implies that discrete signals are not

    periodic for all values of 0 , nor for all values of N. For example if ,

    then no integer value of or k can be found to make the signal periodic per Eq. (3.21). We can write the expression for the fundamental period now as

    0

    2 kN (3.22)

    The smallest integer k, resulting in an integer N, gives the fundamental period, if it exists. Hence for k =1, we N = N0. Example 3.3 What is the digital frequency of this signal? What is its fundamental period?

    Figure 3.21 Signal of Example 3.3

    The digital frequency of this signal is because that is the coefficient of

    time index n. The fundamental period is equal to 5 samples which we find

    using Eq. (3.22) with k = 1.

    00

    2 25

    2 5N

    Example 3.4

    0 1

    N

    2[ ]

    5 3x n cos n

    2 5

    0N

  • Chap 3 - Discrete-time Signals and Fourier series representation 28 | P a g e

    What is the period of this discrete signal? Is it periodic?

    Figure 3.22 Signal of Example 3.4. The period of this signal is 8 samples.

    The digital frequency is 3

    .4

    The fundamental period is equal to

    00

    2 2 ( 3)8

    3 4

    k kN samples

    The period is 8 samples but it takes 6 radians to get the same sample values again. As we see, the signal covers 3 cycles in 8 samples. As long as we get an integer number of samples in any integer multiple of 2 , the signal is considered periodic. Example 3.5 Is this signal periodic?

    The digital frequency of this signal is .5. Its period from Eq. (3.22) is equal to

    0

    24

    kN k

    Since k must be an integer, this number will always be irrational hence it will never result in repeating samples. The continuous signal is of course periodic but as we can see in the Fig. 3.23, there is no periodicity in the discrete samples. They are all over the place, with no regularity.

    3[ ]

    4 4x n sin n

    [ ] (.5 )x n sin n

  • Chap 3 - Discrete-time Signals and Fourier series representation 29 | P a g e

    Figure 3.23 Signal of Example 3.5 that never achieves an integer number of

    samples in any integer multiple of 2 .

    Do discrete signals have harmonics? What is the relationship of the discrete signal sin[ ]n to a continuous signal

    with k an arbitrary integer?

    In Fig. 3.24, we plot the discrete and continuous harmonics of a sinusoid for k

    = 1, 2, 3. (Chosen arbitrarily.) The sinusoid signal is sampled with sF = 12.

    We set 6

    for the continuous case and 0 2 12 6 for discrete

    case. The six continuous and discrete sinusoids are given as;

    Continuous signal

    ( )x t Discrete signal

    [ ]x n Harmonic 1 sin(2 6)t 6sin n

    Harmonic 2 sin(4 6)t 6sin 2 n

    Harmonic 3 sin(6 6)t 6sin 2 2 n

    The indices are t and n. The index t runs continuously from 0 to infinity, while n takes on only integer values. We plot both the continuous and the discrete harmonics in Fig. 3.24 using these six equations. On the left are the continuous harmonics and on the right are the discrete harmonics.

    sin( )k t

  • Chap 3 - Discrete-time Signals and Fourier series representation 30 | P a g e

    Figure 3.24 - Three analog sinusoids sin( )k t (left) and three discrete sinusoids

    sin[ ]k n (right) and their harmonics. We can distinguish the analog harmonics but

    not discrete harmonics. All discrete harmonics look the same.

    As k increases, the continuous harmonics increase in oscillations. On the left column we see harmonics of the discrete signal with digital frequency of 2

    6

    and as k is increased from 1, 2, and 3, the discrete harmonic are all exactly the same. The harmonics dont change at all, sort of like a standing wave. Its as if you cannot change the looks of a discrete signal by changing the harmonic index, something we can clearly do with an analog signal. This is an important point and we will come back to it again when we talk about the basis functions for Fourier analysis of a discrete signal.

    Discrete harmonics as basis of discrete-time Fourier series The continuous-time Fourier series (CTFS) is written in terms of trigonometric functions or complex exponentials. Because these functions are harmonic and hence orthogonal to each other, both trigonometric and complex exponentials form a basis set for complex Fourier analysis. The series coefficients can be thought of as scaling of the basis functions. We are now going to look at the Fourier series representation for discrete-time signals using discrete-time complex exponentials as the basis functions.

  • Chap 3 - Discrete-time Signals and Fourier series representation 31 | P a g e

    In previous section we showed that that discrete sinusoidal harmonics of the

    form 0sin( )n and 0sin 2 k n are identical to each other, for any

    integer k. The same applies to the complex exponentials. A discrete complex exponential is written by replacing t in continuous-time domain with n, and

    with the digital frequency . Now we have these two forms of the CE just as we wrote the two forms of the sinusoid in Eq. (3.16).

    0

    0

    :

    :

    jk t

    jk n

    Continuous CE e

    Discrete CE e

    Note that the units of the exponents of both and are radians. We expand the discrete form as follows.

    02

    0, 1, 2,jk n

    jk n Ne e k (3.23)

    This is confusing with both k and n indices present in the exponent. In the continuous form, we also have both of these variables, k (an integer multiplier for the frequency) is used to increase the frequency by factor k, whereas t is just time. Here same k is used to increase the frequency and n is time, same as t for the continuous case. So the presence of both n and k should be understood. We give harmonics a general expression like this:

    (2 )[ ] 0,1,2 , 1jk N nk n e k N (3.24)

    All harmonics are a function of time (n in this case) and their frequency is k

    times the fundamental frequency, 20 N . All of these harmonics repeat

    with period N. Index k goes from 0 to N-1. For k = N, we get the same harmonic as k = 0.

    ( )(2 )

    (2 ) (2 )

    0

    [ ]

    [ ]

    j k N N nk N

    jk N n jN N n

    k

    n e

    e e

    n

    (3.25)

    Example 3.6

    Show the harmonics of a discrete exponential of frequency if it is

    being sampled with a sampling period of 0.25 seconds.

    j te j ne

    2 12

  • Chap 3 - Discrete-time Signals and Fourier series representation 32 | P a g e

    The discrete frequency of this signal is 6. For an exponential given by

    , we replace with and t with . ( sT =.25) We write the

    discrete signal as

    Lets plot this signal along with its next two harmonics, which are

    Why is there only one plot? Simply because the three signals are identical and indistinguishable just as we see in Fig. 3.24.

    Figure 3.25 Signal of Example 3.6 (a) the imaginary part is a sine wave, (b) the

    real part, which is of course a cosine. The picture is same for all integer values of

    k.

    This example shows that for a discrete signal the concept of harmonic frequencies as in the CT domain do not lead to meaningful harmonics, both for sinusoids and the discrete-time exponentials. All harmonics are the same. But then how can we do Fourier series analysis of a discrete signal if all exponential orthogonal basis signals are identical? The whole thing is based on uniqueness of the harmonics and hence the importance their coefficients being meaningful. So far we only looked at discrete signals that differ by a phase of Although the harmonics obtained this way are harmonic in a mathematical sense, they are pretty much useless in the practical sense. We call them non-distinct. So where are the distinct harmonics that we can use for Fourier

    analysis? We cannot use 0 and or 02 k since they are not distinct, but

    0j te

    0 6 4n

    24[ ]j n

    x n e

    2 1 224 24 24

    2

    ,j n j k n j k n

    e e and e

    2 .

  • Chap 3 - Discrete-time Signals and Fourier series representation 33 | P a g e

    now we look instead inside the 2 range from any 0k to 0( 1)k . We

    find hiding in this range N unique harmonics perfectly suitable for Fourier analysis. We look at this condition of periodicity of a discrete signal again.

    0 0( )k n n N j ne e

    0 1j Ne For the second statement to be true, the conditions in Eq. (3.21) must be true here as well. This says two important things about discrete signals.

    1. If the digital frequency of a signal is a rational number (a ratio of integers) times then the discrete signal is periodic, else it is not periodic and we cannot do Fourier analysis on it.

    2. Given a discrete signal of period N, the signal will have only N unique harmonics. Each such harmonic is given by

    0

    2[ ]

    2[ ] 0,1, 1k

    n nN

    n k n for k NN

    Increasing k beyond N-1 will give the same harmonic as for k = 0 again. The second condition shows us how this is different from continuous signals. For continuous signals, k can go on to infinity. For discrete signals, this is not so. We have just N unique harmonics and the Fourier analysis must be done using only these N harmonics and no more. Example 3.7 Lets see what happens as digital frequency of a signal is varied just within the 0 to range instead of as integer multiples of . Take this signal

    Its digital frequency is and its period is equal to 6 samples. We

    now know that the signals of digital frequencies and 14 6 are exactly the

    same. So we will increase the digital frequency by 2 but instead in 6 steps,

    each time increasing it by so that after 6 steps, the total increase will be

    as we go from to 14 6 We do not jump from to 14 6 but

    instead are moving in between. We can start with zero frequency or from

    2 2

    2

    6[ ]j n

    x n e

    2 60N

    2 6

    2 6

    2 2 6 2 6

  • Chap 3 - Discrete-time Signals and Fourier series representation 34 | P a g e

    or as it makes no difference where you start. Starting with 0th

    harmonic, if we move in six steps, we get these 6 unique signals.

    The variable k, the index of the harmonics, steps from 0 to . Index n remains the index of the sample or time. Note that since the signal is periodic

    with samples, K is equal to

    We can visualize this process as shown in Fig. 3.26 for N = 6. Harmonic 6 and 11 are identical. This is a set of N harmonics (within any 2 range) that are unique and are the basis set for discrete Fourier analysis.

    Figure 3.26 Discrete harmonic frequencies in the range of 2 m to 2 ( 1)m .

    In Figure 3.26, we plot the discrete complex exponential from Fig. 3.26 so we can examine them visually. There are two columns in this figure, with left containing the real and right the imaginary part, together representing the complex-exponential harmonic. The analog harmonics are shown in dashed lines for elucidation. The discrete frequency appears to increase (more oscillations of the samples) at first but then after 3 steps (half of the period, N) start to back down again.

    Reaching the next harmonic at the discrete signal is back to where it

    started. Further increases repeat the same cycle.

    2 6 2 ,

    1K

    0N 0.N

    2 ,

  • Chap 3 - Discrete-time Signals and Fourier series representation 35 | P a g e

    Figure 3.27 The real and the imaginary component of the discrete signal

    harmonics. They are all different.

    Lets take a closer look. The first Figure in Fig. 3.26, shows a zero frequency harmonic. All real samples are 1.0, since this is a cosine. In (b), the continuous signal is of frequency 1 Hz, the discrete samples come from

    In (c), we see a continuous signal of 2 Hz and discrete samples

    from . We see that by changing the phase from (a) to (g) we have

    gone through a complete cycle. In (g) the samples are identical to case (a) yet continuous frequency is much higher. The samples for case (g) look exactly the same as for case (a) and case (h) looks exactly the same as case (b) and so on.

    cos 2 6 .

    cos(2 3)

    2

  • Chap 3 - Discrete-time Signals and Fourier series representation 36 | P a g e

    Our goal here is to understand the nature of harmonics of a discrete signal. We need the harmonics as a basis set so we can map the analysis signal. The problem is that the discrete harmonics are different from the easy to comprehend harmonic signals of continuous signals. For a discrete signal we find that unique harmonics come not in multiple of

    radians added to the digital frequency but instead inside the 0 to range. These signals are an orthogonal basis set and can be used to create a Fourier series representation of a discrete signal. The weighted sum of these N special signals form the discrete Fourier series representation of the signal. Unlike the continuous-time signal, here the meaningful range of the harmonic signal is limited to a finite number of harmonics which is equal to the period of the discrete signal in samples. Hence the number of unique coefficients is finite and equal to the period N. The book by Stein Ref [] gives a great visual example of this phenomena. Imagine we are seeing the spokes of a wagon wheel in a movie. Now a movie is of course analog reality sampled at 30 frames per second. When the speed of the stage coach is the same as the frame speed, the spokes appear to be stationary but when the coach slows down or speeds up, we see the spokes are either slightly going backwards of forwards. This occurs due to the mismatch of the sampling speed and the actual frequency of the wheel.

    Discrete-time Fourier Series (DTFS) representation The Discrete-time Fourier series (DTFS) is the discrete representation of a discrete-time periodic signal by a linear weighted combination of complex

    exponentials. These orthogonal exponentials exist within just one cycle of the signal with cycle defined as phase shift. Since the number of harmonics available is discrete, the spectrum is also discrete, just as it is for a continuous signal. If a

    discrete signal is periodic with period then there are only

    harmonics, and not an infinite number as in continuous-time Fourier series representation. For example, if we have a signal that is being sampled at 5

    samples per cycle, with , then it has just useable

    harmonics. These are;

    2 2

    0N

    2

    0 ,N 0 0K N

    0

    2

    5

    0 0 5N K

    2 4 6 8 10

    5 5 5 5 5, , , ,j n j n j n j n j n

    e e e e e

  • Chap 3 - Discrete-time Signals and Fourier series representation 37 | P a g e

    Here n is the time index and k ranges from 1 to 5 (shown multiplied by 2 ). The discrete-time representation of a signal is written as the weighted sum of

    these harmonics. Note that when we talk about the period of the signal,

    we refer to it as and when we talk about harmonics we refer to it by

    although they are equal in magnitude. 0 0K N

    We can now write the Fourier representation of the discrete signal x[n] as the

    weighted sum of these harmonics.

    (3.27)

    Note that the harmonic is given by this expression and only K0 of these are unique which defines the range.

    0

    2jk n

    N

    k e

    In Eq. (3.27) are the complex Fourier series coefficients,

    which we discussed in Chapter 2. There are k harmonics, hence you see the coefficients with index k. The DTFS coefficients of the harmonic are exactly

    the same as the coefficient for a harmonic that is an integer multiple of

    samples so that:

    0k k mN

    C C

    The kth coefficient is equal to

    (3.28)

    The coefficient is given by

    0K

    0.N 0K

    0K

    [ ], 0, 1,C k k

    thk

    0mN

    Ck

    = xn=0

    N0-1

    [n]e- jkW

    0n

    0k mK

    Ck+mK

    0( )= x

    n=0

    N0-1

    [n]e- j k+mN

    0( )W0n

    = xn=0

    N0-1

    [n]e- jkWne- jmN

    0W

    0n

  • Chap 3 - Discrete-time Signals and Fourier series representation 38 | P a g e

    The second part of the signal is

    It is equal to 1. (Because the value of the complex exponential at integer multiples of is equal to 1.0) So we have:

    (3.29)

    So from the fact that the harmonics repeat, the coefficients also repeat. This is shown in Fig. 3.13. The spectrum of the discrete signal (comprised of the

    coefficients) keeps repeating after every integer multiple of the samples, or

    by the sampling frequency. In practical sense, this means we can limit the

    computation to just the first harmonics. Again, K0 is equal to N0.

    This is the reason the discrete Fourier analysis of a sampled signal results in

    replicating spectrums. It happens because after the first harmonics, the

    harmonics repeat and so do their coefficients. We get nothing new. This is a very different situation from the continuous signals, which do not have such behavior. The continuous-time coefficients are unique for all values of k. Discrete signal coefficients repeat because as we allow k to vary over all values of digital frequencies from to , yet we can no longer tell the

    harmonics apart outside of 2 . We end up looking at the same numbers

    over and over again.

    DTFS Examples Example 3.7 Find the discrete-time Fourier series coefficients of this signal.

    The fundamental period of this signal is equal to 10 samples from observation. Hence it can only have at most 10 unique coefficients.

    0 0 2jm N n jm ne e

    2

    Ck+mN

    0( )= x

    n=0

    N0-1

    [n]e- j k+mK

    0( )W0n

    = Ck

    0K

    0K

    0K

    k k

    0K

    2[ ] 1

    10x k sin k

  • Chap 3 - Discrete-time Signals and Fourier series representation 39 | P a g e

    Fig. 3.28 Signal of example 3.7 and its Fourier coefficients (a) The discrete signal

    with period = 10, (b) the fundamental spectrum, (c) the true repeating spectrum.

    Now we write the signal in the complex exponential form.

    Note that because the signal has only two frequencies, corresponding to index

    k = 0, for zero frequency and k = , which corresponds to the fundamental frequency, the coefficients for remaining harmonics are zero. We can write the coefficients as

    x[n] = 1+1

    2 je

    j2p

    10

    n

    -1

    2 je

    -2p

    10

    n

    1

    0

    0

    1

    00

    29

    10

    0

    1[ ] [ ]

    1[ ]

    10

    Njk n

    k

    jk n

    k

    C k x n eN

    x n e

    29

    10

    0

    9

    0

    1[n]

    10

    1[

    ]

    ]10

    1

    [0jk n

    k

    k

    C x e

    x n

  • Chap 3 - Discrete-time Signals and Fourier series representation 40 | P a g e

    In computing the next coefficient, we compute the value of the complex exponential for k=1 and then for each value of k, we use the corresponding x[n] and the value of the complex exponential. The summation will give us these values.

    Of course, we can see the coefficients directly in the complex exponential form of the signal. The rest of the coefficients from C2 to C9 are zero. However, the

    coefficients repeat after so that for all k. We see this in the

    spectrum of the signal in Fig. 3.28(c). In Fig. 3.27(b) we show only the fundamental spectrum, but in fact the true spectrum is the one in (c). The spectrum repeats every 10 samples forever. Example 3.8 Compute the DTFSC of this discrete signal. [ ] 2.5 3cos[2 / 5] 1.5sin[2 / 4]x n n n The period of the second term, cosine is 5 samples and the period of sine is 4 samples. Period of the whole signal is 20 samples because it is the least common multiple of 4 and 5. This signal repeats after every 20 samples. The fundamental frequency of this signal is

    0

    0

    9(1)

    1

    0

    9( 1)

    1

    0

    1 1[ ]

    10 2

    1 1[ ]

    10 2

    j n

    n

    j n

    n

    C x n ej

    C x n ej

    9C 1 9 1kC C

    0

    2

    20 10

  • Chap 3 - Discrete-time Signals and Fourier series representation 41 | P a g e

    Figure 3.29 - Signal of example 3.8 (a) The discrete signal with period = 20, (b)

    the fundamental spectrum, (c) the true repeating spectrum.

    The Fourier series coefficients of this signal repeat with a period of 20. Each

    harmonic exponential varies in digital frequency by . Based on this

    knowledge, we can see that the exponential falls at 4,k

    4( /10) 2 / 5 and exponential l falls at 5,k 5( /10) / 2 .

    We can also write this signal as

    2 22 24 45 5[ ] 2.5 1.5 1.5 .75 .75

    n nn nx n e e j e e

    From here, we see that the zero-frequency harmonic has a coefficient of 2.5. The frequency has coefficients of 1.5 and frequency has a coefficient of .75 as shown in Fig. 3.29.

    0

    0

    1

    00

    1910

    00

    1[ ]

    1[ ]

    Njk n

    n

    n

    jk n

    n

    C x n eN

    x n eN

    2

    5

    0

    1[0]

    20

    j

    C x e

    20

    2 5

    2 4

    2 / 5 2 / 4

  • Chap 3 - Discrete-time Signals and Fourier series representation 42 | P a g e

    Example 3.9 Compute the DTFS of a periodic discrete signal that repeats with period 4 and has two impulses of amplitude 2 and 1. The period of this signal is 4 as we can see and its fundamental frequency is

    F3-22Example

    Figure 3.30 Signal of example 3.9. The discrete signal with period = 4 (b) the

    fundamental spectrum, (c) the true repeating spectrum.

    We write expression for the DFSC from Eq.(3.26)

    Solving this summation in closed form is the hard part. In nearly all such problems we need to know series summations or the equation has to be solved numerically. In this case we do know the relationship. We first express the complex exponential in its Euler form. We know values of the complex

    exponential for argument are 0 and 1 respectively for the cosine and sine.

    We write it in a concise way as

    0

    2

    4 2

    Ck

    = xn=0

    3

    [n]e- jk

    p

    2n

    4

  • Chap 3 - Discrete-time Signals and Fourier series representation 43 | P a g e

    and

    We get for the above exponential

    Now substitute this into the DTFSC equation and calculate the coefficients, knowing there are only n = 4 harmonics in the signal because the number of harmonics are equal to the fundamental period of the signal.

    1[0] 2 1) 0.25

    4

    1[1] 2 1) 0.56

    4

    1[1] 2 1) 0.75

    4

    1[1] 2 1) 0.56

    4

    C abs

    C abs j

    C abs

    C abs j

    We see these four values repeated in Figure 3.30(b). Example 3.10 Find the DFS of the following sequence

    02

    cos

    12

    sin

    2

    2 2

    n k

    nk

    e cos jsin

    j

    [ ] [0,1,2,3,0,1,2,3,...]x n

  • Chap 3 - Discrete-time Signals and Fourier series representation 44 | P a g e

    Figure 3.31 - (a) The discrete signal with period = 4, (b) the fundamental

    spectrum, (c) the true repeating spectrum.

    The fundamental period of this series is equal to 4 by observation. We will now use a compact form of the exponentials to write out the solution.

    Note that this W is not a variable but a constant. Its value for these parameters is equal to j. Now we write the coefficients as

    From here we get

    The absolute values of these coefficients normalized by N = 4, are plotted in Fig. 3.31(b) and in the repeating form in (c).

    3

    4

    0

    [ ] [ ] , 0, 1, 2,nk

    n

    C k x n W k

    30.

    4

    0

    3 31.

    4

    0 0

    3 321.

    4

    0 0

    3 331.

    4

    0 0

    (0) [ ] 0 1 2 3 6

    (1) [ ] [ ] 0 2 3 2 2

    (2) [ ] [ ] 2

    (3) [ ] [ ] 2 2

    n

    n

    nn

    n k

    nn

    n k

    nn

    n k

    C x n W

    C x n W x n j j j j

    C x n W x n j

    C x n W x n j j

  • Chap 3 - Discrete-time Signals and Fourier series representation 45 | P a g e

    Now we come to the square pulse which we have been covering in each chapter.

    DTFS of a repeating square pulse signal Find the discrete-time Fourier series coefficients of a square pulse signal of width L samples and duty cycle L/N. Here N is the period of the pulse and L is the width of the pulse itself. We give a definition to this pulse signal as

    (3.30)

    To compute the DTFSC, we will use this important property of geometric series. The summation of such a series is given by

    (3.31)

    This is a very important property and will be utilized often in this book.

    Fig. 3.32- (a) The discrete signal, (b) discrete-time Fourier series (DTFSC)

    coefficients, (c) the true repeating spectrum

    1 1[ ] 0, 1, 2,

    0 ( 1) 1

    mN n mN Lx n m

    mN n m N

    0

    1, 1

    1

    n

    n

    a aa

  • Chap 3 - Discrete-time Signals and Fourier series representation 46 | P a g e

    We write the coefficients of this signal as

    We can use the geometric series of Eq. (3.30) to express the last row as

    This last term can be simplified as follows

    (3.32)

    It does not look much simpler! But if we look only at its magnitude (the front part), we get about as simple as we can get in DSP, which is to say not a lot. The DTFSC for a general square pulse signal of width L and period N samples is now given by

    (3.33)

    The numerator has the duty cycle and the denominator is only a function of the period. This function looks like the sinc function but it is not. It is the Drichlet function. The Drichlet function is a periodic version the sinc

    2

    2

    0, , 2 ,

    1

    1

    N

    N

    j Lnk

    j n

    L n N N

    C eelse

    e

    2 22 2

    2 2 2 2

    2 ( 1)

    1

    1

    sin

    sin

    N NN N

    N N N N

    N

    j Ln j Lnj Ln j Ln

    j n j n j n j n

    j L n

    e ee e

    e e e e

    k L Ne

    k N

    0, 1, 2,

    sin

    sin

    k

    L k

    C k L Nelse

    k N

  • Chap 3 - Discrete-time Signals and Fourier series representation 47 | P a g e

    In Chapter 2 we computed the spectrum of a square pulse signal. The spectrum of that signal was a sinc function, whereas this one repeats because this is a discrete signal. This is an important new development and worth understanding. Now we plot the coefficients of various such square pulse signals. These should be studied so you develop an intuitive feel for what happens as the sampling rate increases as well the effect of the duty cycle, i.e. the width of the pulse vs. the period. Note that all of the spectrums repeat with the sampling frequency.

    Figure 3.33 - A square pulse has Drichlet response as we see in the DTFSC of the

    signal. The width of the main lobe is inversely related of the width of the square

    pulse relative to the period.

  • Chap 3 - Discrete-time Signals and Fourier series representation 48 | P a g e

    Figure 3.34 Spectrum of a periodic discrete square pulse signal. We see the

    DTFSC change as the width of the square pulse increases relative to the period. In

    (a) all we have are single impulses and hence the response is a flat line. In (e) as

    the width gets larger, the DFSC take on an impulse like shape.

    Figure 3.34 shows the DFSC for various widths of the square pulse. As the pulses get wider, the response gets narrower, and when the pulse width is equal to the period, hence it is all impulses, we get an impulse train for a response. This is a very important effect to know.

    The matrix form of the Fourier series

    DFSC are computed in closed form equations for homework problems only. For practical applications, we use Matlab and other digital devices. We will now look at a matrix method of computing the DFSC. Lets first define this common term. It looks strange and confusing, but it is a very simple idea, we are using it to separate out things that are constant.

  • Chap 3 - Discrete-time Signals and Fourier series representation 49 | P a g e

    (3.34)

    For a given value this term, called the W (also called the Twiddle factor) is

    a constant and is being given a shorthand notation so as to make the equation writing easier. We can write the discrete Fourier series (DFS) and inverse discrete Fourier series (IDFS) using this factor as

    (3.35)

    In this form, the terms and are same as

    These terms can be pre-computed and stored to make computation quicker. They are the basic idea behind the FFT algorithm which speeds up computation. We can setup the DFSC equation in matrix form by using the Twiddle factor and writing it in terms of the two variables, the index n and k. Now we write

    (3.36)

    Here we have assumed that K0 = 4. Each column represents the harmonic index k and each row the time index, n. It takes 16 exponentiations, 16 multiplications and four summations to solve this equation. We will come back to this matrix methodology again when we talk about DFT and FFT in Chapter 5.

    0N

    0

    0

    0

    0

    1

    0

    1

    00

    : [ ] [ ]W

    1: [ ] [ ]W

    Nnk

    N

    n

    Nnk

    N

    k

    DFS X k x n

    IDFS x n X kN

    0

    nk

    NW 0nk

    NW

    Ck

    =1

    K0

    x[n]

    W -00 W -10 W -20 W -30

    W -01 W -11 W -21 W -31

    W -02 W -12 W -22 W -32

    W -03 W -13 W -23 W -33

  • Chap 3 - Discrete-time Signals and Fourier series representation 50 | P a g e

    Summary of Chapter 3 1. An ideal discrete signal is generated by sampling a continuous signal with an impulse train of desired sampling frequency. The time between the impulses is called the sample time. 2. The sampling frequency is the inverse of sample time. The sampling frequency of an analog signal should be greater than two times the highest frequency in the signal of interest in order to accurately reconstruct the signal.

    3. The fundamental period of a discrete periodic signal, given by must be

    an integer number of samples for the signal to be periodic in a discrete sense.

    4. The fundamental discrete frequency of the signal, given by is equal to

    It represents the advance of radians per sample.

    5. The period of the digital frequency is defined as an integer multiple of 2 .

    Harmonic discrete frequencies that vary by integer multiple of , such as

    and are identical. 6. Because discrete harmonic frequencies are identical, we cannot use them to create a Fourier series representation. Instead we divide the range from 0 to

    by and use these sub-frequencies as the basis set.

    7. Hence there are only harmonics available to represent a discrete signal.

    The Fourier analysis is limited to these harmonics. The number of available

    harmonics for the Fourier representation, is exactly equal to the

    fundamental period of the signal,

    8. Beyond the range of harmonic frequencies, the discrete-time Fourier

    series coefficients, (DFSC) repeat because the harmonics themselves are identical. 9. In contrast, the continuous-time signal coefficients are aperiodic and do not repeat. This is because all harmonics of a continuous signal are unique.

    0N

    0

    02 .N

    2

    2 k 2 2k n

    2 0N

    0K

    0K

    0.N

    2

  • Chap 3 - Discrete-time Signals and Fourier series representation 51 | P a g e

    10. The coefficients of a discrete periodic signal are discrete just as they are for the continuous-time signals. The coefficients around the zero frequency are called the principal fundamental spectrum. 11. The principal spectrum of a discrete periodic signal, repeats with sampling frequency,

    12. Sometimes we can solve the coefficients using closed from solutions but in a majority of the cases, matrix methods are used to find the coefficients of a signal. 13. Matrix method is easy to setup but is computationally intensive. Fast matrix methods are used to speed up the calculations. One such method is called FFT or Fast Fourier Transform. Copyright 2015 Charan Langton All Rights Reserved

    .sF