 Tutorial: Enhance Your Signal Processing Toolbox with Complex Notation - Embedded.com

# Tutorial: Enhance Your Signal Processing Toolbox with Complex Notation

As the speed of DSP's and digital hardware keeps increasing, software and digital hardware are replacing traditional analog hardware, making today's gizmos and gadgets smarter, more reliable, less expensive, and more power efficient than ever before. As an embedded systems engineer, you may have found yourself doing more signal processing than you originally bargained for! This article about complex notation is a survival guide to some of the most important basics of signal processing.

Begin reading nearly any article on signal processing and you will quickly encounter complex notation. Signals that could be easily represented as sines or cosines become and we’re often reminded that j is the square root of -1. It gets worse – a simple sinusoid actually contains both positive and negative frequencies, but frequently “only positive frequencies are used.” We also see modulated signals referred to as “complex envelopes.” At first glance this notation seems like an unnecessary complication rather than an aid, and has caused many a good engineer to walk away from valuable signal processing information.

Most signal processing textbooks provide an excellent review of complex notation, but these descriptions are sometimes more general and involved than the working engineer wants. This article presents the basics of complex numbers as used in signal processing, and will provide you with the tools for using them. Through the examples used in this article you will gain a clear understanding of AC circuit analysis using phasors and also get introduced to some of the key components of a QPSK receiver.

The Basics of Complex Numbers
Figure 1 shows a complex number. The “real” part of the number, Re(C) , is represented by the horizontal component and the “imaginary” part of the number, Im(C) , is represented by the vertical component. The complex number appears immediately useful because, like a sine wave, it has both a magnitude and an angle. If we change the sign of the imaginary part we obtain the complex conjugate of the number, and we designate the complex conjugate with the overbar symbol: The complex number can be represented various ways: Note that the rectangular forms of equations 1 and 2 allow convenient addition and subtraction of complex numbers. The polar form of equation 3 allows convenient multiplication and division.

If phi is a phase angle which increases linearly with time then the complex number in Figure 1 rotates in a counter-clockwise circle. Letting the magnitude of the complex number be unity, equation 2 becomes: and it’s evident that the real part of this expression is a simple cosine wave. Furthermore, equations 1 through 4 can be easily manipulated to yield other useful forms: Several things are readily apparent from equations 5 through 8. First they are related: equation 7 is the result of adding equations 5 and 6, and equation 8 is the result of subtracting equation 6 from equation 5. Equations 5 and 6 can also be viewed as two counter-rotating vectors in which the complex parts always cancel thereby accounting for the real result. Equation 6 can be viewed as two counter-rotating vectors where the real parts cancel. Equations 1 through 8 can also be used to derive useful identities such as: But the most significant observation is that if we wish to take advantage of complex exponentials, we must either use the abstraction of complex numbers (equations 5 and 6) or the abstraction of negative frequencies (equations 7 and 8).

Linear filtering and phasors
The problem of determining the steady state response of a linear network to a sinusoidal input is an excellent application of complex notation. However, working the problem once will show that steady-state analysis can be done virtually by inspection using the phasor technique. This section will reinforce what we’ve covered so far by showing why the phasor technique works.

Digital and analog filters can be described by complex frequency domain transfer functions. For example the lowpass RC filter shown in Figure 2 has the transfer function:  A property of this filter is that its transfer function has conjugate odd symmetry, as expressed in the following: Equations 7 and 8 show that the sinusoidal excitation also have odd symmetry. We will use the superposition property of linear networks to determine the output of the filter. Stated mathematically: In other words, the output due to the sum of two input signals is equal to the sum of the outputs due to the individual inputs. A quick glance at equations 5 through 8 suggests that this property should come in handy.

The input to the network is the cosine from equation 7. Using superposition, the output signal is simply the sum of the outputs due to the two components in equation 7. Because of the conjugate symmetry of both the input signal and the transfer function, the operations in equations 13 through 18 are identical for any network. As a result, to find the response of a network due to a sine wave, you simply need to know the magnitude and phase response of the network at the desired frequency. In circuit analysis complex numbers are represented using shorthand called phasor notation as shown below. Setting the angular frequency to 1/RC, the steady state problem above is solved quickly using phasors as follows: Narrowband signals And complex notation
In signal processing we frequently work with narrowband signals as shown in Figure 3, below. A narrowband signal has its energy concentrated around a frequency usually near the center of the signal's bandwidth called the carrier . Channelized signals can usually be treated as narrowband signals. Complex notation allows us to focus only on the bandwidth containing the signal rather than the bandwidth containing both the signal and the carrier. It also suggests hardware and software structures that aid processing of lowpass signals. To illustrate, consider the signal processing used for QPSK data transmission shown in Figure 4, below. QPSK, or Quadrature Phase Shift Keying is a data transmission technique where groups of two bits of data are encoded into one of four phase shifts of a sinusoidal carrier. The phase shift is held for the symbol time , and then it is updated based on the next pair of bits in the input bit stream. Since the symbol rate is usually much lower than the carrier frequency, the result is a narrowband signal.

It is natural to use complex notation to represent the two bits comprising each symbol. The index k is used to indicate that the signal represents a pair of bits in a serial bit stream. Signals sjk and sqk are the kth in phase and quadrature signal components that take values of 1, and s k denotes the complex signal sjk + j sqk . The complex baseband signal could also be represented as Mapping these signals on the complex plane results in the constellation shown in Figure 5, below. The two multipliers at the left of Figure 4 up-convert the complex baseband signal to the carrier frequency. This is shown graphically in Figure 6 where multiplication shifts the complex baseband spectrum is shifted to the right, and taking the real part adds the negative frequency component. Equations 22 to 25 below describe the operation of the up-converter. The output is the real modulated signal m(t). (This expression for m(t) is valid for the kth only. Refer to the sources below for an accurate description of a modulated data signal). At the receiver the signal encounters a bandpass filter used for rejecting out-of-band signals. The bandpass filter response is not symmetric about the carrier frequency and it distorts the signal slightly.

The two multipliers and lowpass filters after the bandpass filter are used to down convert the signal to its lowpass representation. We'll elaborate on the down converter since it is a commonly encountered signal processing operation. One way to explain the operation of the down converter is to begin with the signal as described by equation 25, multiply the sines and cosines and note that the lowpass filter removes the double frequency terms resulting from the multiplications. But instead of using sines and cosines, we'll use our newfound skills with complex notation.

For the top arm we have: The identities in equations 9 and 10 and the Euler identities allow us to write this as: The low pass filter removes the double frequency term on the right. Multiplying by two yields the final result: The I and Q branches at the output of the down-converter are lowpass signals and can be sampled at a much lower rate than the modulated signal, which reduces both power consumption and hardware cost. Figure 4 shows the I and Q branches combined into a single heavy line indicating that the signal is complex. A clear advantage of complex notation is that the frequency and phase differences between the transmit and receive oscillators are maintained by equations 31 and 32.

The next step for the QPSK receiver to recover the transmitted data bits si and sq is to correct for the frequency offset and phase offset between transmitter and receiver. The process of removing these offsets is called carrier recovery, and the receiver has the means to detect them and internally generate the signal The process of applying the correction is often referred to as de-rotation because the frequency offset causes the baseband phasor to rotate at the difference frequency. However this is simply complex multiplication as shown by equation 33 and implemented in Figure 7. Though the structure appears formidable, it can be done in just a few lines of DSP code.  The final step for recovering the transmitted data bits is to remove the distorting effects of the bandpass filter at the receiver input. The modem has the means for identifying the distortion based on statistical characteristics of the distorted input or corrected output. This process is called adaptive equalization , and the result of the equalization process is the complex filter shown in Figure 4 at the right of the de-rotator. (The oversimplification is for the sake of clarity. In this example, the output from the carrier recovery would have a slight phase error because its input has been distorted by the bandpass filter. Modern demodulators frequently perform carrier recovery and equalization jointly.)

Before describing the complex filter, observe the signal spectrum shown in Figure 8, below. The operation of the down converter can be viewed as shifting the positive portion of the spectrum left and discarding the negative frequency term. The de-rotator further shifts the signal so that the overall shift precisely matches the frequency (and phase) of the up-converter. However the shifted signal is not symmetrical about DC. The i and q signals from the de-rotator are real signals. But when viewed as i + j* q, the result is complex and the asymmetrical spectrum is perfectly acceptable. Equalization of the asymmetrical signal spectrum requires an asymmetrical filter for the equalizer. To see how this works note that when a signal is passed through a linear filter, the resulting signal spectrum is equal to the spectrum of the input signal multiplied by the frequency response of the filter. If both the spectrum and the filter are complex we have: Figure 9 below shows an implementation of the complex equalizer. The i and q signals from the equalizer precisely match those at the transmitter. Another tool in the DSP toolbox!
As engineers, we strive to avoid unnecessary complexity, and abstractions such as imaginary numbers and negative frequencies sometimes fall into this category and end up on the chopping block. In reality, complex notation is a valuable tool for any engineer working with signal processing because:

(1) Working with exponentials is much less tedious than working with sines and cosines.
(2) Signal processing articles and technical papers use complex notation extensively.
(3) Complex notation suggests hardware and software structures for implementing signal processing functions.

The intent of this article has been to provide a set of tools for understanding and working with complex notation. Most signal processing textbooks (see references below) include a chapter or section dedicated to narrowband signals. These are excellent references, and most include much of the mathematical rigor not included here. The information in this article should allow you to breeze through the basics and get the most out of that next signal processing article.

References
 J. Proakis, Digital Communications , McGraw Hill, 1983, Chapter 3
 H. Meyr, M. Moeneclaey, A. Fechtel, Digital Communication Receiver s, Wiley Interscience, 1998. Chapter 1.
 M. Schwartz, W. Bennett, S. Stein, Communication Systems and Techniques , McGraw Hill, 1966, Chapter 1.

Barry Dorr is the owner/president of Dorr Engineering Services, Inc., which specializes in signal processing, modem development, and embedded servos. He can be reached at

This site uses Akismet to reduce spam. Learn how your comment data is processed.