Frequency domain tutorial, part 2: complex signals and spectral diagrams
Part 2 introduces quadrature (complex) signals, and explains the nature, and notation, of the spectral diagrams used in DSP.
By Richard Lyons, Besser Associates
DSP DesignLine
(06/18/08, 01:20:00 PM EDT)
This series is drawn from the course "DSP Made Simple for Engineers." For more information, see Besser Associates. This article is also available as a PDF

Part 1 discusses the ambiguities of discrete signals.

A brief introduction to quadrature signals
Let's now focus on describing a quadrature signal, having a real and an imaginary part, that is a function time. To do so we must remember that, as the great mathematician Karl Gauss first recommended, a single complex number can be represented by a point on the two-dimensional complex plane. Such a plane has two axes (real and imaginary) that are orthogonal to each other, meaning there is a 90° difference in the axes' orientations. Consider a complex number whose magnitude is one, and whose phase angle increases with time. That complex number is the ej2πfot point shown on the complex plane in Figure 4. (Here the 2πfo term is frequency in radians/second corresponding to a frequency of fo cycles/second where fo is measured in Hz.) As time t increases the complex number's phase angle φ = 2πfot increases and our number orbits the origin of the complex plane in a counterclockwise direction. Figure 4 shows that number, represented by the solid dot, frozen at some arbitrary instant in time. (That rotating ej2πfot complex number goes by two names in the DSP literature; it's often called a "complex exponential", and it's also referred to as a "quadrature signal.") If, say, the frequency fo = 2 Hz then the solid dot would rotate around the circle two times, or two cycles, per second.


Figure 4. A snapshot, in time, of two complex numbers whose exponents, and thus their phase angles, change with time.

Because complex numbers can be represented in both polar and rectangular notation, we can represent our polar ej2πfot quadrature signal (using one of Leonhard Euler's identities) in rectangular form as:

ej2πfot = cos(2πfot) + jsin(2πfot).    (2)

Equation (2) tells us that as ej2πfot rotates around the origin its real part, its East-West distance from the origin, varies as a cosine wave. The complex exponential's imaginary part, the North-South distance from the origin, varies as a sinewave. (Understanding the nature of a sinusoidal quadrature signal is no more difficult than reading a road map.) The attributes of our two-dimensional ej2πfot complex exponential are best illustrated with a three dimensional time-domain plot as in Figure 5. Notice how the ej2πfot signal spirals so beautifully along the time axis with its real part being a cosine wave and its imaginary part being a sinewave. At time t = 0 the signal has a value of 1 + j 0 as we would expect. (Equation (2) allows us to represent a single complex exponential as the orthogonal sum of real cosine and real sine functions.)


Figure 5. The value of the ej2πfot complex exponential signal.

That ej2πfot signal is not just mathematical mumbo jumbo! We can physically generate an ej2πfot signal and transmit it to a laboratory down the hall. All we need is two equal-amplitude sinusoidal signal generators, set to the same frequency fo. (However, somehow we have to synchronize those two hardware generators so that their relative phase shift is fixed at 90°. Their outputs need to be orthogonal.) Next we connect coax cables to the generators' output connectors and run those two cables, labeled 'Cosine' for our cosine signal and 'Sine' for our sinewave signal, down the hall to their destination. In the other lab, if the continuous real signals were connected to the horizontal and vertical input channels of an oscilloscope, as in Figure 6, we'd see a bright spot rotating counterclockwise in a circle on the scope's display. (Remembering, of course, to set the scope's Horizontal Sweep control to the 'External' position.)


Figure 6. Quadrature ej2πfot signal oscilloscope display.

Pop quiz: What would be seen on the scope's display if the cables were mislabeled and the two real signals were inadvertently swapped? If you said we'd see another circle orbiting in a clockwise direction, pat yourself on the back because you'd be correct.

This oscilloscope example helps us answer the important question, "When we work with quadrature signals, how is the j‑operator implemented in hardware?" The answer is that the j‑operator is implemented by how we treat the two real signals relative to each other. We have to treat them orthogonally such that the cosine signal represents the Real (East-West) value, and the sinewave signal represents the Imaginary (North-South) value. So in our oscilloscope example the j‑operator is implemented merely by how the connections are made to the scope, and the result is a two-dimensional quadrature signal represented by the instantaneous position of the dot on the scope's display.

By the way, if we control the instantaneous phase of the ej2πfot signal based on some bipolar binary data (+1 and –1), a person on the other lab could measure that phase at certain instants in time and extract that binary data. Many digital communications systems operate on this principle. OK, back to business. At this point you may ask, "Where does the idea of negative frequency come in here?" Well, there's a 'Negative Frequency' signpost up ahead and we're now ready to answer that question.

Don't be negative about negative frequency
The notion of negative frequency is often troubling to engineers who've spent so much time examining the spectra displayed on analog spectrum analyzers. Some engineers think of frequency, by its very nature, as something that cannot be negative. Such as, say, starting your car and driving minus ten miles. Well, we can give negative frequency a solid physical meaning by defining it properly in the context of complex, or quadrature, signals. Let's do that now.

Returning to Figure 4, we can also think of another complex exponential e–j2πfot, the white dot, orbiting in a clockwise direction because its phase angle φ = –2πfot becomes more negative as time increases. Again, if the frequency fo = 2 Hz then the white dot would rotate around the circle two times, or two cycles, per second in the clockwise direction. By definition, we call that rotational frequency minus two cycles per second. Those two complex exponentials in Figure 4 are of great interests to us because of what is obtained when they're summed algebraically. For example, what is the sum of the positive-frequency counterclockwise rotating ej2πfot and the negative-frequency clockwise rotating e–j2πfot when we add their real and imaginary parts separately? That's right. The sum is a oscillating function whose imaginary part is always zero. That real-only sum is a cosine wave whose peak amplitude is 2. If the magnitudes of the complex exponentials in Figure 4 had been 0.5, instead of 1, they would graphically depict another important Euler identity:

cos(2πfot) = ej2πfot/2 + e–j2πfot/2 .    (3)

Equation (3) allows us to represent a real cosine wave as the sum of positive-frequency and negative-frequency complex exponentials. By our definitions, a positive-frequency complex exponential's exponent is positive, and a negative-frequency complex exponential has a negative exponent.

Another Euler identity, Eq. (4), gives the relationship of a real sinewave as the sum of positive-frequency and negative-frequency complex exponentials.

sin(2πfot) = j(ej2πfot/2) – j(e–j2πfot/2).    (4)

Those j‑operators in Eq. (4) merely describe the relative phase of the complex exponentials at time t = 0 as illustrated in Figure 7.


Figure 7. The two complex exponentials, at time t = 0, that comprise a sinewave.

At time t = 0, Eq. (4) becomes:

sin(2πfot) | t=0 = j (e–0/2) – j (e0/2) = j/2 – j/2 = 0    (5)

complying with our knowledge that a sinewave's amplitude is zero at time t = 0. Don't worry if these concepts of the j‑operator and complex exponentials seem a little perplexing at this point. You'll get used to them. (Even the great Karl Gauss struggled with these ideas at first. He called the j‑operator the "shadow of shadows".)

OK, let's not forget where we're going here. Our ultimate goal is understand the nature of the spectral diagrams used in DSP. In doing so we had to define the notion of negative frequency and that definition is inherent in the complex-valued (real and imaginary) representation we use for discrete spectra in DSP. Unlike the amplitude-only results seen when you use an analog spectrum analyzer, in the world of DSP our spectrum analysis provides complex-valued results. That is, discrete spectra show the relative phase shifts between spectral components.

Let's look at the complex spectra of a few simple sinusoids, from the viewpoint of Euler's identities, as shown in Figure 8. The time-domain waveform and the complex spectra of a sinewave defined by sin(2πfot) is shown in Figure 8(a). Shifting that sinewave in time by 90° gives us a cosine wave shown in Figure 8(b). Another shift in time by φ° results in a arbitrary-phase cosine wave in Figure 8(c).

Remember now, the positive and negative-frequency spectral components of the sinewave rotated counterclockwise and clockwise, respectively, by 90° in going from Figure 8(a) to Figure 8(b). If those cosine wave spectral components continued their rotation by φ° we'd have the situation shown in Figure 8(c). We show these three-dimensional frequency-domain spectra, replete with phase information, because in the world of DSP we're often interested in spectral phase relationships. We use the FFT algorithm to measure spectral magnitude and phase the way an analog engineer uses a network (vector) analyzer. (In case you hadn't noticed, Figure 8 illustrates a very important signal processing principle. A time-domain shift of a time-periodic signal results only in phase shifts in the frequency domain, spectral magnitudes do not change.)


Figure 8. Complex frequency domain representation of three sinusoids.

The top portion of Figure 8 illustrates Eq. (3) and the center portion is a graphical description of Eq. (4). Thankfully, we've almost reached our goal! Figure 8 reminds us that one legitimate way to show the spectrum of a real cosine wave is to include both positive and negative-frequency spectral components.

With this thought in mind, we could draw the spectral magnitude (ignoring any phase information) of a continuous 400 Hz sinusoid as shown in Figure 9(a) showing the inherent spectral symmetry about zero Hz when we represent real signal spectra with complex exponentials. By 'real signal' we mean an x(t) signal having a non-zero real part but whose imaginary part is always zero. (Our convention is to treat all signals as complex and to think of real signals as a special case of complex signals.) Figure 9(a) is another graphical representation of Euler's identity in Eq. (3).


Figure 9. The spectral magnitude plot of (a) a 400 Hz continuous sinusoid, and (b) a discrete sequence of a 400 Hz sinusoid sampled at a 2 kHz sample rate.

If we apply our convention of 'spectral replications due to periodic sampling', we can illustrate the spectral magnitude of discrete samples of a 400 Hz sinusoid, sampled at an fs = 2 kHz sampling rate, as that in Figure 9(b). And so there you are. Figure 9(b) is typical of the spectral magnitude representations used in the DSP literature. It combines the spectral replications (centered about integer multiples of fs) due to periodic sampling as well as the use of negative frequency components resulting from representing real signals in complex notation. (Whew!)

To review the spectrum of another discrete sequence, Figure 10(a) shows the spectral magnitude of a continuous x(t) signal having four components in the range of 100 Hz to 700 Hz where dark and light squares distinguish the positive and negative-frequency spectral components. Figure 10(b) shows the spectral replication for a discrete x(n) sequence that's x(t) sampled at 2 kHz. The sole purpose of this article is to show the meaning, relevance, and validity of Figure 10(b) in representing the spectrum of discrete samples of a real sinusoid in the complex-valued world of DSP. This figure reminds us of the following important properties: continuous real signals have spectral symmetry about 0 Hz; discrete real signals have spectral symmetry about 0 Hz and ±fs/2 Hz.


Figure 10. Spectrum of a signal with four components in the range of 100 Hz to 700 Hz. (a) Spectral magnitude of the continuous signal. (b) Spectrum of a sampled x(n) sequence when fs = 2 kHz, and (c) spectrum of the x'(n) sequence when fs = 1.3 kHz.

Figure 10 illustrates why the Nyquist Criterion for lowpass signals—signals whose spectral components are centered about zero Hz—states that the fs sampling rate must be equal to or greater than twice the highest spectral component of x(t). Because x(t)'s highest spectral component is 700 Hz, the fs sample rate must be no less than 1.4 kHz. If fs were 1.3 kHz as in Figure 10(c), the centers of the spectral replications would be too close together and spectral overlap would occur. We see that the spectrum in the range of –1 kHz to +1 kHz in Figure 10(c) does not correctly represent the original spectrum in Figure 10(a). This unfortunate situation is typically called aliasing, and it results in x'(n) sample values that contain amplitude errors. For real-world, information carrying, signals there is no way to correct for those errors.

For clarity, let's describe this situation using different words. Given the proper sampling shown in Figure 10(b), we could apply the x(n) samples to a digital-to-analog converter, followed by high-performance analog filtering, and exactly regenerate (reconstruct) the original analog x(t) signal. With the improper sampling in Figure 10(c), there is no way to generate the original analog x(t) signal using the corrupted x'(n) samples.

In Figure 10(c) we can see that the spectral overlap is centered about fs/2 and that particular frequency is important enough to have its own name; it's sometimes called the folding frequency, but more often it's called the Nyquist frequency. We can make the following very important statement relating continuous and discrete signals, "Only continuous frequency components as high as the Nyquist frequency (fs/2) can be unambiguously represented by a discrete sequence obtained at an fs sampling rate." Figure 10(c) also reminds us of another fundamental connection between the worlds of continuous and discrete signals. All of the continuous x(t) spectral energy shows up in the discrete x'(n) sequence's spectral frequency range of –fs/2 to +fs/2.

The purpose for showing replicated spectra as we did in Figure 10 is not to cause complication or confusion, but to provide a straightforward explanation for the effects of overlapped spectra due to aliasing. (Drawing replicated spectra is also useful in illustrating the spectral translation that takes place in bandpass sampling, and describing the result of frequency translation operations such digital down-conversion.) With that said, we conclude this article with an explanation of the various, and sometimes puzzling, notations used for frequency-axis labeling in the DSP literature. Don't touch that dial.

Discrete frequency-axis notation
In the world of DSP, for convenience, frequency-domain drawings are often labeled in hertz using the fs sampling rate. This convention is best explained with a couple of examples; the first of which is when we perform spectrum analysis (using the FFT) of, say, a real time-domain audio sequence obtained at an fs = 11.025 kHz rate. We could plot our spectral magnitude results using either frequency-axis labeling convention shown in Figure 11. If we later discovered that the sample rate was actually fs = 22.05 kHz, we would not have to repeat our spectral analysis nor redraw our spectral plots because the frequency axis is referenced to fs.


Figure 11. Example spectral magnitude plots; (a) zero Hz on the left, (b) zero Hz in the center.

Another example of labeling frequency-domain plots using hertz is in describing digital filters. A five‑point moving average digital filter has the frequency magnitude response shown in Figure 12(a). That frequency response curve is the same whether the filter is used in an fs = 40 megasample/second digital communications system or in an fs = 8 kilosample/second telephone system.


Figure 12. Frequency magnitude response of a 5‑point moving average digital filter.

DSP authors have several other choices in labeling the frequency-axis of their frequency-domain plots. For example, the cyclic frequency (Hz) labels in Figures 11 and 12 can be converted to radians/second.[4,5] We do so by replacing fs with ωs, where the signal data sample rate is

ωs = 2πfs    (6)

with ωs measured in radians/second as shown in Figure 12(b).

Sometimes DSP purists, to make the notation more concise, assign fs a value of one which leads to the notation that ωs = 2π. Thus, in their DSP books you'll see frequency-domain plots like Figure 13(a) where the frequency-axis is a normalized angle with –fs/2 replaced with –π, and fs/2 replaced with π. The justification for doing so goes something like this: let's represent a sinewave, whose frequency is f Hz, by x(t) = sin(2πfot). Discrete-time samples of x(t) are:

x(n) = sin(2πft) | t=nts = sin(2πfnts)    (7)

where the integer n sequence is the sample number (often called the "index") of x(n). With the factors 2πf having the dimension of radians/second, and ts having the dimension seconds/sample, the resultant angle in Eq. (7) has the dimension of radians/sample. If we replace Eq. (7)'s ts with 1/fs, the discrete sinusoidal samples can be represented by:

x(n) = sin(2π f/fs n) = sin(θn)    (8)

where θ is what I call a "normalized discrete-signal frequency". If we assume |fo| ≤ fs/2 (satisfying Nyquist), then the normalized discrete-signal frequency θ is in the range of –π to +π measured in radians/sample. This definition is why some authors like to say, "For continuous signals, frequency is measured in radians/second. For discrete signals frequency is measured in radians/sample." Redrawing the filter response from Figure 12(b), we illustrate the normalized discrete-signal frequency-axis representation in Figure 13(a).

Just so you know that I'm not making all of this up, Figure 13(b) shows how a MATLAB built-in plotting function uses the radians/sample frequency notation.


Figure 13. Filter response plots using the normalized discrete-signal frequency notation of radians/sample.

If you've spent your technical career thinking about frequency measured in cycles/second (Hz), the frequency-axis labeling in Figure 13 might seem very odd. However, it's not so strange. Consider the discrete sinewave in Figure 14(a), whose sample values repeat every 12 samples. It takes 12 samples to complete one cycle (360°) of oscillation. Likewise we can say it takes 6 samples to complete one radian (180°) of oscillation. From that last statement, we declare the discrete-signal frequency of the sinewave to be one sixth radians/sample. A spectral plot of the sinewave is shown in Figure 14(b).


Figure 14. A discrete sinewave, (a) time-domain samples, (b) frequency-domain samples.

To consolidate our thoughts we list various frequency-axis notations in Table 1. The third column of Table 1 shows the frequency range of analysis when using the FFT.


Table 1: Various frequency-axis notation.

It often takes a DSP novice some time to become comfortable with these various frequency-axis notations. Fortunately commercial signal processing software packages, like LabVIEW, Mathcad, and MATLAB, allow us to conveniently label our frequency-domain plots in good ol' hertz.[6–8]

References
[6] LabVIEW - National Instruments Corp., Austin, TX, http://www.ni.com/labview/
[7] Mathcad - Parametric Technology Corp., Needham, MA, http://www.ptc.com/products/mathcad/
[8] MATLAB - The Mathworks Inc., Natick, MA, http://www.mathworks.com

About the author
Richard (Rick) Lyons is a consulting Systems Engineer and lecturer with Besser Associates in Mountain View, California. He is the author of "Understanding Digital Signal Processing 2/E" (Prentice-Hall, 2004), and Editor of, and contributor to, "Streamlining Digital Signal Processing, A Tricks of the Trade Guidebook" (IEEE Press/Wiley, 2007). He is also an Associate Editor for the IEEE Signal Processing Magazine.

Related articles