Introduction to Signals

The Concept of Frequency

Wireless signals between two devices travel through the use of radio waves. A radio wave is an electromagnetic wave propagated by an antenna. Radio waves have different frequencies, and one can pick up a specific signal by tuning a radio receiver to a specific frequency. But what is a frequency anyway?

A Complex Sinusoid

Consider a complex number in an -plane with an angle and length as shown in this Figure. Its projection on -axis is equal to and projection on -axis is equal to . Now imagine rotating with an angle continuously increasing with time. Then, can be treated as a signal with time as independent variable and we call it a complex sinusoid. Just like velocity is the rate of change of displacement, frequency is the rate of change in phase of a complex sinusoid. This rate of change of phase results in rotating in the time -plane at an angular velocity , as shown in Figure below.

Note that as time passes, is shown in Figure above as coming out of the page. When its projection from a -dimensional plane to a -dimensional plane formed by time and -axis is drawn, we get . Similarly, when the projection is drawn on a -dimensional plane formed by time and -axis, it generates . Randomly choosing as our reference sinusoid, the component is called inphase because it is in phase with while component is called qaudrature because is in quadrature — i.e., apart — with .

In conclusion, a complex sinusoid with frequency is composed of two real sinusoids

(1)

where is the continuous frequency with units of cycles/second or Hertz (Hz). The direction of rotation is considered positive for anticlockwise rotation, and negative for clockwise rotation.

Amplitude and phase are the two other parameters that characterize a sinusoidal signal, where determines the maximum amplitude for the sinusoid, and determines the initial angular offset of at .

Sinusoid parameters

Remember that whenever you hear the word “frequency”, it is the frequency of a sinusoid or . There are parameters that characterize a sinusoid:

1. Frequency
2. Phase
3. Amplitude

Referring to this Figure, it is clear that if the complex sinusoid rotates faster, the corresponding real sinusoids jump up and down faster, the time for completing one period becomes smaller, and we call it a higher frequency. Therefore, it is related to time period as

and the range of continuous frequency values is

Example

When one tunes to a radio station at MHz, one is actually listening to a station broadcasting a radio signal at a carrier frequency of Hz, which means that the transmitter is oscillating at a frequency of cycles/second. Accordingly, that wave is completing one period in ns.

What is a Negative Frequency?

Negative frequencies can cause some confusion as it is hard to visualize a negative frequency viewed as inverse period of a sinusoid. Since the term magnitude is absolute value of the amplitude, the inverse period only gives the magnitude of that frequency. Define it through the rate of rotation of a complex sinusoid in this Figure, and it is evident that a negative frequency simply implies rotation of in a clockwise direction. Negative frequencies are real, just like negative numbers are real.

A Real Sinusoid

We have learned that a complex sinusoid rotating in time -plane generates two real sinusoids. The question is: How to produce only one real sinusoid in complex plane?

Interestingly, just like a complex sinusoid is made up of two real sinusoids (Eq (1)), a real sinusoid can be produced by two complex sinusoids rotating in opposite directions to each other, one with a positive frequency and other with a negative frequency . From Figure below, it can be seen that components of the complex sinusoids cancel out in this scenario while parts add up to form a cosine wave. As before, time dimension, not shown here, is coming out of the page.

From the definitions of a complex sinusoid in Eq (1) and conjugate of a complex number in this Eq, a real cosine wave can be written as

The amplitudes of both complex sinusoids are scaled by to cater for factor from addition of two similar parts. A sine wave can also be constructed in a similar manner.

Frequency Domain

Above, we have talked about frequency being the rate of rotation of a complex sinusoid in time -plane (as in this Figure). It is evident that this rate of rotation can be changed from very slow (close to ) to as fast as possible (close to ). As also explained above, a clockwise direction of rotation implies a negative frequency, and hence the complete range of frequencies of a complex sinusoid is from to . When a signal or function is drawn in frequency domain, the graph actually shows the and components of those complex sinusoids whose frequencies are present in that signal.

Since one complex sinusoid has a single frequency, it is drawn as a narrow impulse on the frequency -plane. Remember that this frequency -plane is different than the time -plane drawn in this Figure earlier.

Let us look at examples of a real cosine wave and a real sine wave in frequency domain representation in Figure below.

Time -plane vs Freq -plane

The arrows in frequency -plane are not rotating like this Figure and this Figure earlier. In fact, these are frequency domain impulse symbols indicating a single spectral line for a single complex sinusoid. The height of the impulses in frequency domain indicates the magnitude of that sinusoid while their relative phases can be seen through the directions in which the spectral impulses are pointing.

Any signal plotted in frequency domain represents the magnitudes and phases of complex sinusoids combined together to form that signal. As such, they form a basic unit of signal construction of any shape. As more and more such sinusoids come together, they form a continuum in frequency domain that is illustrated as a continuous spectral graph.

A natural question arises at this stage: What about the signals having components other than these nice looking sinusoids? The answer is surprising: There are hardly any! Long ago, scientists figured out that most signals of practical interest can be considered as a sum of many sinusoids — possibly infinite — oscillating at different frequencies regardless of the signal shape. So an arbitrary signal can be written as

where , , are amplitudes that determine the impact each sinusoid has on . If has no sinusoid of frequency , then the corresponding amplitude .

It is difficult to believe in such a statement for many signals with sharp edges like a square or triangular waveform but this concept is true even for such signals. In that case, the number of sinusoids participating in construction of that signal tends to .

As an example, consider a square wave signal. The curves in Figure below show how it is approximated with integer multiples of a fundamental frequency (the corresponding negative axis in frequency domain is not shown for simplicity).

The blue curve consists of the first two terms

which is clearly quite inaccurate. However, increasing this approximation with just three more terms in red curve as

displays significantly closer behaviour. If we increase the number of sinusoids with respective decreasing amplitudes, we can improve this approximation even more.

Spectrum and Bandwidth

A frequency spectrum, or simply the spectrum, is just the range of all possible frequencies of electromagnetic radiation. A full continuous spectrum, for example, includes radio waves, microwaves, infrared, ultraviolet, x-rays and gamma rays.

In an ideal world, bandwidth of a signal is the range of frequencies of sinusoids present in that signal. In other words, taking into account all the sinusoids, the bandwidth is simply the difference between the highest frequency and the lowest frequency in the spectrum of that signal.

An ideal band-limited signal has a spectrum that is zero outside a finite frequency range :

Having said that, a signal can have a very low contribution from a sinusoid of a particular frequency but not completely zero. Skipping the mathematical proof, we present the following argument: Remember that the concept of frequency is defined through sinusoids that are infinitely long in time domain, see this Figure. Since sinusoids exist only for a finite duration in real-world, the spectrum of these truncated sinusoids is not an impulse as shown in this Figure. Instead, frequency domain representation of a finite duration sinusoid spreads out in the entire spectrum from to .

Time and frequency support

A signal cannot be limited in both time and frequency domains. For practical implementations, a signal must be time limited which makes it unlimited in frequency. Therefore, every real signal occupies an infinite amount of bandwidth. A band-limited signal is then referred to as a signal with most of its energy concentrated within a certain amount of frequency range. Practical definitions of bandwidth vary depending on that amount of energy.

For example, Federal Communications Commission (FCC) defines bandwidth as the band in which of the signal power is contained. Another common definition is that everywhere outside the specified band, a certain attenuation (say, dB) must be attained.

As a general rule, signals with fast irregular variations have large bandwidth as a large number of sinusoids are required to build such a signal, while slowly varying signals have low bandwidth. Consequently, signals that are narrow in time domain have a large bandwidth in frequency domain, and vice versa.

Some Signal Classifications

Some signals have specific properties which makes computations simpler. For example,

Even and Odd

A signal is called even (or symmetric) if

Flipping an even signal around amplitude axis results in the same signal. Examples of even signals are and a quadratic signal (see e.g., this Figure).

On the other hand, a signal is called odd (or anti-symmetric) if

An odd signal has symmetry around the origin. Examples of an odd signal are and .

Periodic and Aperiodic

A signal is periodic if it repeats itself after a certain period .

Both and are examples of periodic signals if is a rational number.

If a signal does not repeat itself forever, there is no value of that satisfies the above periodicity equation. Such a signal is known as aperiodic, an example of which is a unit step signal and most other signals encountered in this text.

Discrete Frequency

We have talked about the concept of frequency and sampling a continuous-time signal to generate a discrete-time signal. Remember that the reason we work with discrete-time signals is that finite computer memory can store only a fixed number of time values. Similarly, this finite memory can also store only a fixed number of frequency values instead of infinite range of .

For this reason, while we are at sampling in time domain, we also want to sample the frequency domain. Assume that a total of samples were collected in time domain (see this Figure) at a rate of , thus spanning a time duration of seconds. Then, the lowest frequency that can be represented by these samples is the one by a signal that completes one full cycle — and no more — during this interval of seconds and consequently given by Hz. Consider the equation

and observe that

• Frequency resolution, determined by the lowest frequency that can be represented, is given by .
• Viewed as , we can get discrete frequency samples that are integer multiples of , if we want the same number of frequency samples as the time domain samples.

As explained in the article on sampling, the unique range of continuous frequency is , or

called the primary zone. To obtain the discrete frequency axis, is divided into equal intervals (assuming is even) by sampling at instants

(1)

resulting in a discrete frequency resolution of . So discrete frequency is basically the spectral content in the primary zone sampled at equally spaced frequency points. The term is absent because it is the same as owing to the axis periodicity.

Eq (1) can also be written as

(2)

Consequently, the index of discrete frequency axis shown in Figure below is given by , or

(3)

Comparing Eq (1) and Eq (2), we arrive at the relation between discrete frequency and continuous frequency as

(4)

From the above equation, the actual continuous frequency represented by discrete frequency index depends on both the sample rate and as

For example, with kHz and ,

Each is therefore called a frequency bin and the value determines the number of input samples and the resolution of discrete frequency domain. Understanding the sampling theorem and the relationship between continuous and discrete frequencies will make the further concepts much easier to grasp.

The units of discrete frequency from Eq (4) are

Discrete frequency axis

Eq (4) is one of the two most fundamental relations in digital signal processing, the other being the sampling theorem. These are the two interfaces between continuous and discrete worlds.

Establishing the relationship between continuous and discrete frequencies gives the frequency domain as a sequence of numbers stored in a processor memory.

When in doubt about continuous and discrete frequency domains, refer to Eq (4)!

Having known the discrete frequency axis, it is natural to ask how these discrete frequencies physically look like. Of course, these are frequencies of a set of complex sinusoids with both and components, as defined in a previous post about complex sinusoids and shown in Figure below for .

Following are a few key observations in this figure.

• For , the sinusoid is because , while sinusoid is because . Of course in a time -plane, this means a point standing still at .
• The and waveforms for are and and they complete on full cycle during samples. This is true in general. Here for a sample rate of kHz, it resulted in kHz with a time period equal to ms. One full cycle ensues because samples at kHz span a time duration of ms as well. Similarly, each complex sinusoid for each span complete cycles in an interval of samples.
• For negative values of , sinusoids remain unchanged while sinusoids change sign. This can be observed from the definition of a complex sinusoid rotating in an -plane as shown in this Figure and this Figure. part is same for both positive and negative directions of rotations, whereas part is positive for positive direction and negative for negative direction.

In conclusion, the range of unique discrete frequencies is

(5)

From the above discussion, the rate of oscillation in discrete-time signals decreases with going from to and increases from to , remembering that is the same as .

Example

Consider a signal

It is clear that continuous frequencies present in this signal are kHz, kHz and kHz. Since the maximum frequency is kHz, the sampling theorem gives the Nyquist rate as kHz = kHz.

Now suppose that this signal is sampled at kHz, the folding frequency is then given by kHz. Sampling the signal at equal intervals of

If this signal is reconstructed in continuous-time domain, the frequencies present are and . From Eq (4), these appear as continuous frequencies at kHz and kHz. Since only kHz is less than and hence within aliasing-free range, it is still there after sampling. The other two are above the folding frequency and hence aliased to kHz and kHz.

In these articles, every time we write the expression involving a discrete frequency, we express it either as or , instead of that is used in most texts. The former clearly indicates the presence of a sampled discrete frequency analogous to the variable in , while it is easy to lose this meaning in the latter (the expression more closely resembles a Fourier series description, which we keep out to keep the explanations simple). In addition, dealing with complex numbers through an notation not only describes how they are implemented in actual electronic circuits, but it also constantly reminds us how phase is equally important in signal analysis. It is easy to overlook this fact in other more commonly used notations.

Transforming a Signal

Transforming a discrete-time signal — whether in time or amplitude — is certainly possible, and often in interesting ways. In practice, scaling and time shifting are the two most important signal modifications encountered. Scaling changes the values of dependent variable on amplitude-axis while time shifting affects the values of independent variable on time-axis.

Below we describe addition and multiplication of two signals as well as scaling and time shifting a signal in detail.

For addition of two discrete-time signals, say and , add the two signals sample-by-sample: for every , e.g.,

and so on.

Multiplication

For multiplication, multiply the two signals sample-by-sample, as we did with addition: for every , e.g.,

and so on.

Scaling

Scaling implies multiplying the signal amplitude by a constant number resulting in , where can be positive, negative, greater than or lower than . For example, Figure below shows a signal scaled by 4 (compare the amplitudes of both signals on y-axis). One word of caution: The whole signal gets scaled by the same value here and hence scaling is different than sample-by-sample multiplication of two signals.

Time Shifting

A signal can be shifted to the right or left by any amount . There are two ways to look at time shifting a signal.

Conventional Method – Shifting the Signal

Most textbooks on discrete-time signals describe this process as follows.

[Delay] For , the time shift results in a delay of by units of time. So plot by shifting two units to the right as shown in Figure below.

[Advance] For , the time shift results in an advance of by units of time. So plot by shifting two units to the left as shown in Figure below.

This is simple to remember: Write the time shift as . Shift right for and shift left for .

There are two problems with the approach above.

1. It does not explain why we are doing what we are doing.
2. A confusion might arise in the following way. The past samples of the sequence are to the left of the origin while the future samples are to the right. When we advance a signal by shifting left, a beginner might think that the future samples are on the left side. A similar argument holds for delaying a signal.

Intuitive Method – Shifting the Axis

This method is based on the earliest notions of time kept by humans: past, present and future. Replacing the word present with the NOW, consider the following quote:

"Realize deeply that the present moment is all you have. Make the NOW the primary focus of your life."

Eckhart Tolle – The Power of Now

In signal processing applications, NOW is the time index and we want to make it the primary focus of a signal’s life, as shown in Figure below.

Looking from this perspective,
[Delay] For , clearly implies traveling units in the past. So plot by going 2 units back in time and making it the new NOW, i.e., time index 0 as shown in Figure below.
[Advance] For , obviously implies a future travel of units. So plot by going 2 units towards the future and making it the new NOW, i.e., time index 0 as shown in Figure below.

Stated in another way, just look at the time-axis itself. Keep the discrete-time signal as it is, but move 0 time index units to the left for and units to the right for , as in Figure above. Notice that index 0 of is at the same sample as index of , which indicates accessing a future value. Although the difference is only how to look at the process, this is a simpler and more intuitive approach. This will be very helpful when we will discuss the topic of convolution later.

Note that as far as drawing time shifted signals is concerned, we will mostly use the first approach because it saves page space by aligning the time-axis indices right on top of one another.

Understanding time shifting a signal makes it easy to analyze seemingly complicated equations such as

which is basically addition of for and . We can simply break it down to a more recognizable form by substituting values of as

Now we can easily draw the time shifted versions of and add them together to find the resultant signal. An example with a unit impulse signal and its time shifted versions is illustrated in Figure below.

Flipping or Time-Reversal

When the independent variable is replaced by , the signal is reflected or flipped around the time origin because the sample at shifts to , sample at shifts to , and so on. Figure below illustrates this concept by plotting and .

Note that the rules of shifting to the left or right also become reverse due to the flipped time-axis, , itself. For example, from the perspective of intuitive method above, an axis of instead of suggests that the past becomes the future, and vice versa. Hence, first flips the signal around time origin, then travels units to the past to label it the new NOW (time index ).

Circular Shift

Circular shift is very similar to time shifting of a signal, except that the available axis for time shifting a signal is from to while we only focus on a segment of samples for a circular shift.

If a signal is circularly right shifted by , the samples of the signal that fall off to the right of length- segment reappear at the start. Similarly, if is circularly left shifted by , the samples of the signal that fall off to the left of length- segment reappear from the end. Just like a video game character which disappears at one end of the screen to emerge from the other (Pac-man, for example).

A simple rule to remember circular shift is "what goes around comes around".

As circular shift is done with respect to a length- segment, shifts are computed modulo and denoted as , where means shifting the signal as we normally would, but bringing them back in the range from the opposite side. For example, the next Figure shows two examples of circular shifts:

1. is a right shift of in every respect, except for sample at time index . Instead of going to index , it returns from the left at index .
2. Again, is a left shift of for most samples, except for samples at time indices , and . Instead of going to negative time, these three samples return from the right at indices , and , respectively.

As an exercise, try drawing and . You will find that these shifts are actually the same as and , respectively.

An interesting question at this stage is: what will be the result of a circularly flipped signal ? The logic of circular shift stays the same. Like regular flipping, the sample at index remains fixed. The sample at index should take a position at but there is no negative indexing in circular notation and , which takes it to index . Figure below shows for the same signal as above.

The significance of circular shift will become clear when we discuss the Discrete Fourier Transform (DFT) later.

If you found this article useful, you might want to subscribe to my email list below to receive new articles.

DFT Examples

Having covered the Discrete Fourier Transform (DFT) and the concept of phase, we discuss a few examples of DFTs of some basic signals that will help not only understand the Fourier transform but will also be useful in comprehending concepts discussed further.

A Rectangular Signal

A rectangular sequence, both in time and frequency domains, is by far the most important signal encountered in digital signal processing. One of the reasons is that any signal with a finite duration, say seconds, in time domain (that all practical signals have) can be considered as a product between a possibly infinite signal and a rectangular sequence with duration seconds. This is called windowing and a rectangular sequence is the simplest form of a window. Windowing is a key concept in implementation of many DSP applications.

Let us compute the -point DFT of a length- rectangular sequence

(1)

shown in Figure below, where .

Since this sequence is real with no component in time domain, the component in frequency domain from DFT definition can be expressed as

(2)

Let and using the identity , we get

where all the other terms in the summation cancel out. Using the same identity as above

Plugging in the expression back for ,

(3)

Similarly, component can be found from DFT definition,

Following the same procedure as component, and using the identity , the component of its DFT is given by

(4)

Despite its simplicity, there is a lot of information hidden and several interesting conclusions to be drawn here for which we continue further discussion below.

Magnitude and Phase

Applying the definitions of magnitude and phase to Eq (3) and Eq (4) and using , we get the magnitude and phase of the DFT of a rectangular signal.

(5)

(6)

The above Figure displays the magnitude and phase plots for the DFT of a rectangular signal with which in this case are similar to the and plots, respectively. In general, magnitude-phase and plots convey different information, many examples of which we will encounter throughout this text. In most situations, magnitude-phase plot delivers a great deal of information while in some others, plot is more relevant. How a specific value of affects the phase plot is discussed in the concept of phase.

DFT, Frequency Domain Sampling and Leakage

For DFT of a rectangular signal, the equations are given in Eq (3) and Eq (4), and the magnitude-phase equations in Eq (5) and Eq (6). The corresponding figures are drawn in the Figure above with single impulses at bin 0.

The question is: How can such complex equations generate such simple figures? The answer is that it was a special case due to the whole sequence being equal to one. For an and using Eq (6), the rectangular signal can be made symmetric around zero position, as shown in Figure below for , and (which is the same as due to DFT input periodicity in DFT periodicity Eq).

Now consider the case of , and . The sequence can be imagined as shifted to the left by from its symmetric position around zero. and plots from Eq (3) and Eq (4) are shown in Figure below.

Similarly, the magnitude and phase plots from Eq (5) and Eq (6) are plotted in Figure below.

A clear shape of sinc function in terms of is visible in magnitude plot which is sampled at discrete frequencies . Now we can recognize that the plots in this Figure were also sinc functions but sampled at the peak value at bin and at zero crossings for all other bins.

To comprehend the reason why energy appeared in other frequency bins as well, consider that as explained in the article about complex numbers, a complex sinusoid is composed of and as and components, respectively. These and are orthogonal to each other over a complete period, and () of one frequency is also orthogonal to () of other frequencies , provided that are also integers, i.e.,

(7)

The DFT finds the contributions of analysis frequencies for for , in an input signal, which are all integer multiples of a fundamental frequency . It is due to this integer multiplicity that DFT is able to find each contribution independently of all others. And if the input signal contains contributions from only these frequencies, the DFT output is proportional to the magnitude at the contributing frequency bins and zero at the remaining bins.

In a real scenario, the input data sequence is not bound to contain energy precisely at a set of given analysis frequency bins. If the input has a signal component at some intermediate frequency between these integer multiples of , say , Eq (7) does not hold and this input signal shows up to some degree in all output bins of our DFT due to unaligned sampling instants in frequency domain. This is known as DFT leakage.

When we perform the DFT on real-world finite-length time sequences, DFT leakage is an unavoidable phenomenon. Let us construct an example to observe this in detail.

Example

Assume a signal with frequency kHz at a sample rate of kHz.

The solid blue curve is shown in Figure above in time domain along with one analysis frequency kHz. Note that both the input frequency and the analysis frequency complete four full cycles during the sampling interval and hence its DFT, plotted in Figure above, has two impulses at bins and with zero input from all the other bins. The shape of the actual curve is the same sinc function but it is sampled in frequency domain at just the right points — integer frequency bins due to integer number of cycles of the input in time domain.

Now let us change the input signal slightly by making the input frequency equal to kHz as shown in Figure below.

Observe in this Figure below that the analysis frequency completes four full cycles during that interval, while the frequency kHz in the original signal does not have integer number of cycles over -sample interval, causing the input energy to leak into all the other DFT output bins. The bin is not zero because the sum of the products of the input sequence and the analysis frequency is no longer zero (same is also true for, say, ). This leakage causes any input signal whose frequency is not exactly at a DFT bin center to leak into all of the other DFT output bins. The shape of the sinc function did not change as compared to a kHz input but it is sampled in frequency domain at non-ideal points — fractional frequency bins due to non-integer number of cycles of the input in time domain.

One final question: an input sinusoid at kHz sampling the sinc function at unaligned points in frequency domain makes sense, but why the graph in this Figure exhibits a similar kind of leakage? The reason is that an all-ones rectangular sequence with can be considered a single complex sinusoid at frequency but its truncated version with , is not. It is actually made up of all sinusoids just like a periodic square wave we encountered in this Figure.

Mainlobe Peak

The DFT of a rectangular signal has a mainlobe centered about the point. Its amplitude cannot be found by plugging in in Eq (5) because both the numerator and denominator become zero resulting in undefined expression. Although a mathematical trick (known as L’Hôpital’s rule) can be applied to compute it mathematically, we take an easier course. The peak amplitude of the mainlobe is because at , DFT definition dictates that the DFT is the sum of all original samples due to and . Then, the sum of unity-valued samples is . Consequently, the peak value is seen to be in this Figure and in this Figure.

Mainlobe Width and Zero Crossings

The width of the mainlobe is defined by zero crossings of the curve. Since , the first zero crossing occurs when the numerator argument in Eq (5), , is equal to . All other zero crossings are integer multiples of the first. So the mainlobe width is given by the value of the first zero crossing as

This value is confirmed from in this Figure and in this Figure. A zero crossing right at sample in this Figure illustrates that it was sampled at peak value for bin and at zero for all other bins.

DFT Phase

Most of the discussion until now was around the magnitude plots. Let us understand the concept of phase again through the DFT of a rectangular signal. Now the phase plot in this Figure for , and has been drawn in Figure below after unwrapping phase jumps which arose due to changing and signs. The resulting phase is a straight line with a positive slope equal to . Where did this number come from?

We learned in in the article about phase that a time shift of samples results in phase rotation of , the direction of which depends on the direction of time shift. For time traveling in the past (i.e., a signal delay), the phase rotation is also negative while for time traveling in the future (i.e., a signal advance), the phase rotation is also positive.

To complete the picture, we need one extra piece of information that we prove later: the DFT of a real and even symmetric signal is purely real with part. Consequently, its phase is equal to or (depending on the sign of part). In our example, an even symmetric signal would have been obtained for . Then, the phase plot would be or as shown in Figure (part a) below.

However, for , it is a left shift of that even symmetric signal by sample. Thus, plugging in the expression from this Eq gives the phase rotation for each frequency bin as

In this case, was equal to . Starting from , the phase shift can be seen to be from this Figure. For all ,

A linear slope of is thus verified. Part (b) of above Figure shows the phase plot for a right shift of , i.e., . Observe a negative slope of when adjusted for phase jumps.

A General Sinusoid

The DFT of a general sinusoid can be derived similarly by plugging the expression of a complex sinusoid in DFT definition and following the same procedure as in the rectangular sequence example.

Nevertheless, having understood the above concepts, we can see how the magnitude and phase plots of the DFT of a general sinusoid look like by an easier method. As an all-ones rectangular sequence is nothing but a complex sinusoid with frequency with length , the DFT magnitude of a general complex sinusoid with frequency (which can be a non-integer) can be found by putting (as it spans the whole length), (as it starts at ) and instead of in Eq (5) and Eq (6) as

(8)

Similarly, the DFT of a real sinusoid can be seen as the sum of the above expression with a similar expression replacing with because each real sinusoid consists of two complex sinusoids scaled by half.

For example, consider a signal shown in Figure below and consisting of two sinusoids at kHz and kHz as

It can be seen that has only an component with zero component. Sampling the above signal at a rate of kHz produces

(9)

Our DFT analysis frequencies, from this Eq, for an point DFT are

So in this case, bin corresponds to an actual frequency of kHz, bin to kHz, and so on. The DFT can be found by applying DFT definition and is plotted in Figure below.

From magnitude plot of this figure, observe that the DFT has detected two real sinusoids in this signal because the impulses at bins and indicate the presence of two complex sinusoids that combine to form one real sinusoid at a frequency kHz. A similar argument holds for the other frequency of kHz.

DC or Average Value

The DC, or average, value of this signal is which is evident from Eq (9) as the average value of a sinusoid over an integral number of cycles is .

Magnitude

When an input signal contains a complex sinusoid of peak amplitude with an integral number of cycles over input samples, the output magnitude of the DFT for that particular sinusoid is . This can be checked by plugging in the expression for a complex sinusoid into DFT definition. Using Eq (7), the DFT output for a complex sinusoid is given as

Using the identities and ,

Thus, the output magnitude of the DFT is proved as .

For a real sinusoid, is and only the first term in part of the above equation survives. Since , the output magnitude of the DFT for a real sinusoid is .

Considering the fact that is composed of two real sine waves with amplitudes and , we can see in this Figure that kHz sine wave has a magnitude and kHz sine wave has a magnitude .

But if the sinusoid in a rectangular signal is real with frequency , why is the peak value in the magnitude plot in this Figure equal to rather than ? This is because the DFT of a regular real sinusoid is two impulses with amplitude , one at that frequency and the other at its negative counterpart, but at frequency , both of these impulses merge together to give a magnitude of . Another way to understand it is that an all-ones sequence is actually a complex sinusoid at frequency because it has an all-ones sequence in part and all-zeros sequence in part.

Phase

Referring to the phase plot and going back to the DFT definition, assume that the input is . The DFT output is given as

for an arbitrary number and orthogonality of and over a complete period. The phase is for positive and for negative . Therefore, a phase at a particular frequency is with respect to a cosine wave at that same frequency.

In this Figure, bin frequency at kHz has a phase of . Is it a cosine with a phase of ? From the identity , it is indeed a sine waveform with an initial phase of which can be confirmed from the first term of in Eq (9). The corresponding phase at bin is obviously , see this Figure.

As for the second term , it is a sine at kHz with a phase shift of , or a cosine with a phase of as shown in this Figure for bin .

Notice in this Figure how the signal is composed of two sinusoids at and kHz, respectively, where former is a cosine with a phase of (or a sine with ) and the latter is a cosine with a phase of (or a sine with ). Now referring to its time domain plot in this Figure, the first sinusoid is positioned around the origin according to its cosine (or sine) phase, while the second sinusoid is positioned around the origin according to its cosine (or sine) phase. Through the phase plot, the DFT in fact finds the time alignments of all the sinusoids at bin frequencies .

Time vs Frequency

Sometimes it is easy to get confused from the fact that component of is in the above example, leading to an incorrect phase result of or . However, as illustrated in this Figure, we have to differentiate -plane of time domain from -plane of frequency domain. The component here is in time domain only but the phase plot is determined by components in frequency domain. There, a real sinusoid is a sum of two complex sinusoids and the phase of those two complex sinusoids in frequency -plane determines the starting sample of the real sinusoid in time domain.

Do remember that the plots shown in this Figure are — once again — sinc functions overlapping each other. However, since the signal consists of two exact analysis frequencies, the frequency domain is sampled at the precise locations of zero crossings. That being the case, the sinc function becomes invisible and looks like two sets of impulses only.

In the meantime, if you found this article useful, you might want to subscribe to my email list below to receive new articles.

The Unit Impulse

Having known the DFT of a rectangular signal, we have two ways to find the Fourier transform of a unit impulse.

[Time-Frequency Duality] A closer look at DFT and iDFT equations reveal that the forward and inverse transform are almost identical, except the scaling factor and direction of rotations of analysis sinusoids. Therefore, time and frequency domains are dual and DFT of a signal in time domain can be derived by the iDFT of a signal in frequency domain. For example, a single impulse at frequency bin in this Figure is an all-ones rectangular sequence in time domain. By duality, the inverse is also true: a single impulse in time domain corresponds to an all-ones rectangular sequence in frequency domain.
[Rectangular signal] From a general rectangular sequence as in this Figure, it is evident that a unit impulse is also a rectangular sequence with length . Therefore,

(10)

Since the starting sample , the angle is equal to . This DFT was graphically illustrated in this Figure.

The Sampling Sequence

The sampling sequence is a sequence of unit impulses repeating with a period within our observation window (and owing to DFT input periodicity, outside the observation window as well). Figure below illustrates the sampling sequence in time domain for and .

To compute its DFT, consider that and . Then,

Since except when , we can write where . We are assuming as an integer here because otherwise will not be periodic. So in the above example, for non-zero values of at and .

Note that the above equation is very similar to Eq (2) encountered while computing the DFT of a rectangular sequence. Therefore, substituting both the length of the sequence and observation window equal to in Eq (5) and doing the same for part, we get

(11)

Magnitude and Phase

The sequence is plotted in frequency domain in Figure below, where both and components are shown for and . Since the sequence is aligned in time such that it is symmetric with respect to zero, the phase is zero in frequency domain. So the magnitude plot is the same as the part.

Mainlobe Peak

In the DFT of a rectangular signal, we saw that both the numerator and denominator become equal to zero for . In that case, the peak of the mainlobe was equal to , the length of the sequence. We found this value by plugging in the DFT definition and deduced that the result is just a sum of all time domain samples because and . Here in this case, the peak value can easily be seen as the sum of unit impulses and hence equal to .

Remember from DFT of a general sinusoid derived above that the DFT of a complex sinusoid with amplitude in time has a magnitude in frequency domain. Here, the spectral replicas have a peak magnitude of instead of which suggests that the actual spectrum has been scaled down by a factor of . This is shown in Figure above.

Mainlobe Positions

There are multiple impulses in frequency domain here: more than one as in DFT of an all-ones rectangular sequence but less than as in the DFT of a unit impulse. Observe from Eq (11) that when the denominator is non-zero, the spectrum is clearly zero. When both the numerator and denominator are zero, the peak values are as above. To find these locations, check where the denominator is an integer multiple of as well.

In our example, these peaks turn out to be and as shown in Figure above. If you guessed that these impulses in frequency domain are actually sinc functions sampled at just the peak and zero values, you are right (compute a length- DFT of this sequence instead of length-, for example).

Miscellaneous

Finally, later in another post, we will summarize some important properties of the DFT in a table. In that table, one of the most important properties of DFT we use over and over again is the Parseval’s relation that relates the energy of a signal in time domain with the same in frequency domain.

(12)

In words, energy of a signal in time domain is equal to its energy in frequency domain scaled by . The intuitive reason for this scaling factor in frequency domain is that as discussed above, the DFT output for a complex sinusoid with amplitude is , an time magnification.