Chapter 3 ft I and Q Signals D ra The concepts of in-phase signal and quadrature signal are important in modern signal processing. They are two different and complementary points of view of a given signal. When both are available for a received modulated signal being processed, demodulation can be performed with simple calculations. When building a new signal for transmission, any form of modulation can be implemented by changing the characteristics of a reference signal and its quadrature and then combining them. Any form of modulation or demodulation can be expressed with the in-phase and quadrature signals. Generally speaking, the term quadrature is used to refer to an angular separation of π/2 radians between two entities. When used to talk about signals, the in-phase is a reference sinusoid and its quadrature is another sinusoid but phase-shifted by π/2 radians relative to the reference sinusoid. The letter I is used to designate an in-phase signal. The letter Q denotes its quadrature signal. It is the in-phase signal relatively shifted in phase by π/2 radians (or 90 degrees). For example, the quadature of a cosine signal is the sine signal. An example is plotted in Figure 3.1. The dotted line represents an in-phase reference signal at frequency one Hz. The in-phase has been generated using the cosine function. The dotted line represents its quadrature and it has been made using the sine function. The Octave script representing the signal generators is the following: 1 2 3 4 5 6 7 8 9 10 11 12 % Generator of an in−phase signal and its quadrature % −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− % Create an array of 1000 time instants, in steps of 0.001 s. time=[0:999]*0.001; % Create the in−phase (I) signal at frequency f f=1; % Hz Isignal=cos(2*pi*f*time); % Create the quadrature (Q) signal Qsignal=sin(2*pi*f*time); % Plot the signals plot(time, Isignal,':r'); hold on; 57 © 2015 Michel Barbeau Software Defined Radio I (..) and Q (−−) Signals 1 0.8 0.6 0.2 ft Amplitude (V) 0.4 0 −0.2 −0.4 ra −0.6 −0.8 −1 0 0.1 0.2 0.3 0.4 0.5 0.6 Time (s) 0.7 0.8 0.9 1 Figure 3.1: An in-phase (I) reference signal (dotted line) and its quadrature (Q) signal (dashed line), both are at one Hz. The in-phase is generated using the cosine function while the quadrature is produced using the sine function. 13 14 15 D 16 plot(time, Qsignal,'−−b'); % Annotations grid on; title('I (..) and Q (−−) Signals'); xlabel('Time (s)'); ylabel('Amplitude (V)'); 17 18 An array of 1000 time instants is created on line 4. The in-phase signal at one Hz is generated on line 7 using the Octave function cos. Its quadrature is produced on line 9 with the Octave function sin. The rest of the script uses the Octave function plot to draw the signals. Exercise 3.1 Modify the example to express the quadrature signal with a cosine function. 58 CHAPTER 3. I AND Q SIGNALS © 2015 Michel Barbeau Software Defined Radio Exercise 3.2 Exercise 3.3 ft Modify the example to express the same signal, but with a negative frequency. Use the three-dimensional plotting function plot3() to draw a model combining the in-phase and quadrature signals into a single 3D signal (as in Figure 1.11). ra A complex signal consists of two parts: a real part and an imaginary part. An I, Q pair can be represented as a complex signal cos(ωt) + jsin(ωt). The term ω denotes the angular frequency, in radians per second (i.e., ω is of the form 2πf ). The symbol t denotes time. Their product yields an angle. In the complex representation, the cosine signal is the real part and the sine signal is the imaginary part. The function R() is used to select the real part of a complex signal. For example, R(cos(ωt) + jsin(ωt)) yields cos(ωt). The following equality is due to Euler ejωt = cos(ωt) + jsin(ωt). D Processing of signals is best done using their exponential representation, not their cosine, sine form. For example, the frequent operation of mixing two signals at angular frequencies ω1 and ω2 is done in the exponential form as a sum of the two signals ejω1 t · ejω2 t = ej(ω1 +ω2 )t . Exercise 3.4 Using the Euler equality, expand the expression ejω1 t · ejω2 t and show that it is equivalent to ej(ω1 +ω2 )t . CHAPTER 3. I AND Q SIGNALS 59 © 2015 Michel Barbeau 3.1 Software Defined Radio Signal Construction ft The in-phase signal and quadrature signal concepts are relevant to both the demodulation and construction of a new signal. The sum of an in-phase reference signal and its quadrature, with controlled amplitudes, can be used to generate a new signal of determined peak amplitude and phase offset. Before we go any further, let us recall the trigonometric notion of tangent, see Figure 3.2. The y 1 0.8 y1 0.6 ra φ 0.4 0.2 x 0 x1 −0.2 −0.2 0 0.2 0.4 0.6 0.8 1 1.2 D Figure 3.2: The tangent of the angle φ, denoted tan(φ), is defined as the ratio y1 /x1 . tangent of the angle φ, denoted tan(φ), is defined as the ratio y1 /x1 . The inverse function is denoted as arctan. Given a ratio, it yields a corresponding angle. Using the concepts of in-phase and quadrature, a signal can be constructed using the equality A cos(ωt + φ) = I cos(ωt) + Q sin(ωt). (3.1) On the right side of the equality, there is a reference cosine and its quadrature, the sine function. They are both at angular frequency ω, in radians per second. The peak amplitude of the in-phase is determined by the factor I while the one of the quadrature is decided by the factor Q, both in Volts. The left side of 60 CHAPTER 3. I AND Q SIGNALS © 2015 Michel Barbeau Software Defined Radio the equation is the generated signal. It has peak amplitude A, in Volts, angular frequency ω and phase offset φ, in radians. These are two interesting facts. Firstly, the peak amplitude of the new signal is determined by the I and Q factors, that is, p (3.2) A = I 2 + Q2 Volts. Secondly, the phase offset φ is determined by Q radians. I (3.3) ft φ = arctan ra Note that because tan φ is equal to tan(π + φ), most of the implementations of Equation 3.3 return an angle in the range −π/2 to π/2 radians. One must look at the signs of I and Q to determine in which quadrant the angle belongs (see Exercise 9.3). Let us consider an example. Quadrature Phase-Shift Keying (QPSK) modulation uses four different signal symbols. It implies that two bits can be coded per signal element, using one of the four possible symbols. The four different symbols correspond to four different shifts of the phase of the carrier signal, namely, π/4, 3π/4, 5π/4 and 7π/4 radians. Figure 3.3 pictures the first symbol of QPSK. The in-phase signal (dotted line) and quadrature signal (dashed line) are as in Figure 3.1. The arc tangent of π/2 is one. That is, in Equation 3.3 both I and Q must have the same value, e.g., one. Hence, the new signal simply results from the sum cos(ωt) + sin(ωt), with ω = 2π radians. Exercise 3.5 D Modify the example of Figure 3.3 such that the peak amplitude of the new signal is one Volt. Figure 3.4 pictures the third symbol of QPSK. The in-phase signal (dotted line) and quadrature signal (dashed line) are as in Figure 3.1. The arc tangent of 5π/4 is one. That is, in Equation 3.3, both I and Q must the same have value, but are negative because we are in the 3rd quadrant. The amplitude of the I and Q are selected according to Exercise 3.5 Hence, the new signal simply results from the sum −I cos(ωt) − Q sin(ωt), with ω = 2π radians. Modulation based on Equation 3.1 is termed Quadrature Amplitude Modulation (QAM). By an appropriate selection of values for I and Q, any kind of modulation can be implemented using QAM. This fact is exemplified in the upcoming chapters. CHAPTER 3. I AND Q SIGNALS 61 © 2015 Michel Barbeau Software Defined Radio I (..), Q (−−) and new (solid) signals 1.5 1 ft Amplitude (V) 0.5 0 −0.5 ra −1 −1.5 0 0.2 0.4 0.6 0.8 1 1.2 Time (seconds) 1.4 1.6 1.8 2 Figure 3.3: An in-phase (I) signal (dotted line) and its quadrature (Q) signal (dashed line) are combined together according to the equation cos(ωt) + sin(ωt) to produce a new signal (solid line) which phase is shifted by π/4 radians relative to the in-phase signal, with ω = 2π radians. 3.2 Exponential Modulation D All modulations techniques can be nicely and uniformly described using the complex-signal exponential form ejωt , introduced in Section 1.5. From a practical point of view, working with the exponential form versus the cosine-sine form means that additions replace products in Frequency Modulation (FM) and Phase Modulation (PM) signal processing. Assuming low cost back-andforth conversion of the exponential form, it is a great advantage given that the addition is computationally cheaper than the product. Each element of a signal is a symbol. As a function of the modulation techniques, Table 3.1 lists the corresponding signal symbols. The number of symbols sent per second is the baud rate. The unit is the bauds. It corresponds also to the data rate over the number of bits represented by each symbol. For example, two-state AM represents two bits per symbol. One amplitude corresponds to the binary value zero while the other is assigned to the binary value one. 62 CHAPTER 3. I AND Q SIGNALS © 2015 Michel Barbeau Software Defined Radio I (..), Q (−−) and new (solid) signals 1 0.8 0.6 0.2 0 −0.2 −0.4 −0.6 −0.8 0.2 0.4 0.6 0.8 1 1.2 Time (seconds) 1.4 1.6 1.8 2 ra −1 0 ft Amplitude (V) 0.4 Figure 3.4: An in-phase (I) signal (dotted line) and its quadrature (Q) signal (dashed line) are combined together according to the equation −I cos(ωt) − Q sin(ωt) to produce a new signal (solid line) which phase is shifted by 5π/4 radians relative to the in-phase signal, with ω = 2π radians. The amplitude of the I and Q are selected according to Exercise 3.5. Table 3.1: Signal symbols as a function of the modulation technique (A is a positive real number, in m-state PM θ0 is the phase of the first symbol). Modulation Signal symbols Two-state AM A, A/3 2πk ej m +θ0 , with k = 0, . . . , m − 1 a + jb, with a, b ∈ {−A, −A/3, A/3, A} ej2πfo t , ej2πf1 t , with f0 = −160 Hz and f1 = 160 Hz D m-state PM Sixteen-state QAM Two-state FM Four-state AM encodes two bits per symbol. The four symbols correspond to the binary values 00, 01, 10 and 11. If there are m states, then the number of bits per symbol is log2 m. CHAPTER 3. I AND Q SIGNALS 63 © 2015 Michel Barbeau Software Defined Radio Exercise 3.6 Let θ0 be equal to π/8 in eight-state PM. Calculate the value of the exponent for each of the eight symbols. ft h(t) 1 t T ra 0 Figure 3.5: The square wave h(t). Let T be the period of a symbol. Let h(t) be a square wave function such that h(t) is equal to one for 0 ≤ t < T and null elsewhere, see Figure 3.5. Let us assume that a sequence of n symbols is sent, with n a positive integer. Let ck denote the k-th symbol transmitted, with k = 0, . . . , n − 1. The sequence of symbols is converted into a continuous signal by the function ψ(t) = n X ck h(t − kT ). k=0 D with t ∈ [0, nT [. Note that h(t−kT ) has value one in the time interval [kT, kT + T [ and zero elsewhere. For example, if the following sequence of eight symbols is transmitted: A, A/3, A, A, A/3, A/3, A, A/3. The ψ function is defined in the time interval [0, 8T [ and is equivalent to ψ(t) = A · h(t) + A/3 · h(t − T ) + A · h(t − 2T ) + A · h(t − 3T ) + A/3 · h(t − 4T ) + A/3 · h(t − 5T ) + A · h(t − 6T ) + A/3 · h(t − 7T ). Note that the function h(t − kT ) selects the symbol ck during the time interval [kT, (k + 1)T [. Let f Hz be the frequency of a carrier. As a function of time t, the carrier is modeled by the expression ej2πf t . The modulated signal is defined by the 64 CHAPTER 3. I AND Q SIGNALS © 2015 Michel Barbeau Software Defined Radio function ! s(t) = R ψ(t)ej2πf t , (3.4) where R returns the real part of a complex number. 1 0.6 0.2 0 −0.2 ra Amplitude (V) 0.4 ft 0.8 −0.4 −0.6 −0.8 −1 0 1 2 3 4 Time (s) 5 6 7 8 , D Figure 3.6: Two-state AM exponential modulation (states are as in Table 3.1, T is one second, f is 5 Hz, symbols are A, A/3, A, A, A/3, A/3, A, A/3). Figure 3.6 illustrates the application of Equation 3.4 using two-state AM exponential modulation. The signal states are as in Table 3.1. The symbol period T is one second. The frequency of the carrier f is 5 Hz. The eight signal symbols are again A, A/3, A, A, A/3, A/3, A and A/3. Figure 3.7 illustrates the application of Equation 3.4 using eight-state PM exponential modulation. The signal states are as in Table 3.1. The symbol period T is one second. The frequency of the carrier f is 5 Hz. Four PM symbols are sent ej7π/8 , ejπ/8 , ej5π/8 and ej11π/8 . CHAPTER 3. I AND Q SIGNALS 65 © 2015 Michel Barbeau ft Software Defined Radio 1 0.8 0.6 0.2 ra Amplitude (V) 0.4 0 −0.2 −0.4 −0.6 −0.8 0.5 1 1.5 2 Time (s) 2.5 D −1 0 3 3.5 4 , Figure 3.7: Eight-state PM exponential modulation (states are as in Table 3.1, T is one second, f is 5 Hz, symbols are ej7π/8 , ejπ/8 , ej5π/8 , ej11π/8 ). 66 CHAPTER 3. I AND Q SIGNALS