Difference between revisions of "IQ Complex Tutorial"
(→Some maths) 

(22 intermediate revisions by 3 users not shown)  
Line 1:  Line 1:  
<! IQ_complex_Signal_Tutorial >  <! IQ_complex_Signal_Tutorial >  
−  This tutorial originates from discussions on discussgnuradio@gnu.org. We will explain why simulating digital communications requires equivalent baseband representation of  +  This tutorial originates from discussions on discussgnuradio@gnu.org. We will explain why simulating digital communications requires equivalent baseband representation of signalswhich in fact are complex signals. For this reason, complex signals are essential in GNURadio. 
−  This tutorial is also intended for non  +  This tutorial is also intended for nonspecialists, as it involves as little maths as possible while presenting most results using GNURadio's flowgraph. Some examples involving simple modulation schemes used in HAM radio are presented. While introducing complex signals can be seen as increasing complexity, we will see that it drastically simplifies the understanding of certain concepts, such as synchronization. 
−  If you are searching for more detailed information please refer to  +  If you are searching for more detailed information, please refer to the literaturesuch as references [[#ancre1[1]]],[[#ancre2[2]]],[[#ancre3[3]]]. 
== Some maths ==  == Some maths ==  
−  This section  +  This section summarizes complex number properties used in this tutorial. More information can be found on 
[[wikipedia: Complex numbercomplex number Wikipedia page]].  [[wikipedia: Complex numbercomplex number Wikipedia page]].  
Line 14:  Line 14:  
A complex number is a number of the form ''a'' + ''jb'', where ''a'' and ''b'' are real numbers, and ''j'' is an indeterminate satisfying ''j''<sup>2</sup>=1 (Mathematician prefer using ''i'' instead of ''j'' used by physicist and radio engineers). For example, z<sub>1</sub>=2+3''j'' is a complex number. The real part Re{''z''} of z<sub>1</sub> is 2 and its imaginary part Im{''z''} is 3.  A complex number is a number of the form ''a'' + ''jb'', where ''a'' and ''b'' are real numbers, and ''j'' is an indeterminate satisfying ''j''<sup>2</sup>=1 (Mathematician prefer using ''i'' instead of ''j'' used by physicist and radio engineers). For example, z<sub>1</sub>=2+3''j'' is a complex number. The real part Re{''z''} of z<sub>1</sub> is 2 and its imaginary part Im{''z''} is 3.  
−  +  <math>z=a+jb </math>  
−  +  <math>\text{Re}\{z\}=a</math>  
−  +  <math>\text{Im}\{z\}=b</math>  
Line 23:  Line 23:  
: <math>r=z=\sqrt{a^2+b^2}</math>  : <math>r=z=\sqrt{a^2+b^2}</math>  
−  The phase φ of ''z''  +  The phase φ of ''z'' (referred to as the ''argument'') is the angle of the radial Oz on the positive real axis. 
: <math>\phi=\arg(z)=\arctan(b/a) </math> (for a≠0)  : <math>\phi=\arg(z)=\arctan(b/a) </math> (for a≠0)  
−  Together, r and φ  +  Together, r and φ provide another means of representing complex numbersboth the polar and exponential forms. 
: <math>z=r \left(cos(\phi) + j sin(\phi) \right) = r e^{j\phi}</math>  : <math>z=r \left(cos(\phi) + j sin(\phi) \right) = r e^{j\phi}</math>  
Line 35:  Line 35:  
: <math>z_1= r_1 e^{j\phi_1}</math>  : <math>z_1= r_1 e^{j\phi_1}</math>  
−  : <math>  +  : <math>z_2= r_2 e^{j\phi_2}</math> 
: <math>z=z_1z_2= r_1r_2 e^{j(\phi_1+\phi_2)}</math>  : <math>z=z_1z_2= r_1r_2 e^{j(\phi_1+\phi_2)}</math>  
−  +  The following complex numbers have a unit magnitude ''r''=1 :  
: <math>+1=e^{j0}</math>  : <math>+1=e^{j0}</math>  
Line 45:  Line 45:  
: <math>j=e^{j3\pi/2} </math>  : <math>j=e^{j3\pi/2} </math>  
−  A complex signal ''c(t)'' can be seen as two real signals ''a(t), b(t)''  +  A complex signal ''c(t)'' can be seen as two real signals ''a(t), b(t)''often written as ''i(t), q(t)''and combined to create a complex signal. It can also be represented by its amplitude over time ''r(t)'' as well as its phase variation over time ''φ(t)'' 
: <math>c(t) = a(t) + j b(t) = r(t) e^{j\phi (t)} </math>  : <math>c(t) = a(t) + j b(t) = r(t) e^{j\phi (t)} </math>  
== Why we need complex and IQ signals ==  == Why we need complex and IQ signals ==  
−  GNURadio software is mainly used to design and study radio communications. Making high frequency transmission requires modulating a high frequency carrier at frequency ''F<sub>0</sub>''. The most common modulation for analog transmissions are  +  GNURadio software is mainly used to design and study radio communications. Making high frequency transmission requires modulating a high frequency carrier at frequency ''F<sub>0</sub>''. The most common modulation for analog transmissions are: amplitude modulation (AM), phase modulation (PM), and frequency modulation (FM). 
[[File:IQ_complex_tutorial_AM_spectrum.pngthumb400pxAM spectrum]]  [[File:IQ_complex_tutorial_AM_spectrum.pngthumb400pxAM spectrum]]  
−  For analog AM, the modulated signal ''m(t)'' is simply the mathematical product of the carrier ''c(t)'' and the baseband signal  +  For analog AM, the modulated signal ''m(t)'' is simply the mathematical product of the carrier ''c(t)'' and the baseband signal ''a(t)''. The corresponding hardware is a mixer whose scheme and mathematical representation is a multiplier. 
: <math>m(t) = a(t) c(t) = a(t) \cos(2\pi f_0t)</math>  : <math>m(t) = a(t) c(t) = a(t) \cos(2\pi f_0t)</math>  
−  We call ''a(t)'' a baseband signal since its spectrum is in a low frequency range starting near 0 Hz (  +  We call ''a(t)'' a baseband signal since its spectrum is in a low frequency rangestarting near 0 Hz (e.g. [020kHz] for a HiFi audio signal). 
The spectrum of an AM modulated signal ''M(f)'' is the translation or the audio spectrum ''A(f)'' around ±''F<sub>0</sub>'' with ''A(f)'' being the entire spectrum of the modulating signal, using both positive and negative frequencies  The spectrum of an AM modulated signal ''M(f)'' is the translation or the audio spectrum ''A(f)'' around ±''F<sub>0</sub>'' with ''A(f)'' being the entire spectrum of the modulating signal, using both positive and negative frequencies  
Line 63:  Line 63:  
: <math>M(f) = \frac{1}{2}\big(A(ff_0) + A(f+f_0)\big)</math>  : <math>M(f) = \frac{1}{2}\big(A(ff_0) + A(f+f_0)\big)</math>  
−  N.B. Negative frequencies are often omitted in spectrum representation since, for real signal (''a(t)'', ''m(t)'' are real) the power spectrum are symmetric around zero  +  N.B. Negative frequencies are often omitted in spectrum representation since, for real signal (''a(t)'', ''m(t)'' are real) the power spectrum are symmetric around zero (more details on this later). 
−  Up to now we have been dealing with real  +  Up to now we have been dealing with real signals. The need for complex signals appears in the next step. Simulation requires sampled signal. Sampling is the operation of observing a continuous signal and taking a finite number of samples at a given sampling rate ''f<sub>s</sub>'' (i.e. one sample each 1/''f<sub>s</sub>'' second). Because a simulator can only make calculations on a finite number of samples, it requires a sampled signal. Nyquist Sampling theorem states that the sampling rate must be greater than twice the maximum frequency ''F<sub>Max</sub>'' in order to reconstruct the original signal from the sampled signal. 
−  : <math>f_s >  +  : <math>f_s > 2F_{Max}</math> 
−  For  +  For a HIFI audio signal, the maximum audio frequency <math>F_{Max Audio}</math> is close to 20 kHz, so the sampling rate must be higher than 40 kHz (44.8 kHz is often used in computer sound cards, 8 kHz is used for mobile phones since voice has a lower frequency range than HIFI audio). 
−  For an AM signal modulated by an audio signal, maximum frequency of the modulated spectrum is <math>F_{Max}=F_0+F_{Max Audio}</math>. Direct sampling of such signal is not possible with conventional hardware such as low cost SDR dongle. If the carrier frequency is close to 1 GHz, the sampling rate should be at least 2 GHz. This is obviously too much  +  For an AM signal modulated by an audio signal, the maximum frequency of the modulated spectrum is <math>F_{Max}=F_0+F_{Max Audio}</math>. Direct sampling of such a signal is not possible with conventional hardware such as a low cost SDR dongle. If the carrier frequency is close to 1 GHz, the sampling rate should be at least 2 GHz. This is obviously too much for the computer to handle (higher than some CPU clocks). 
Flowgraph [[Media:IQ_tutorial_AM_TX_real.grcIQ_tutorial_AM_TX_real.grc]] illustrates amplitude modulation using only real blocks (excepted for bits source). As a consequence, the maximum carrier frequency is limited to several tens of kHz.  Flowgraph [[Media:IQ_tutorial_AM_TX_real.grcIQ_tutorial_AM_TX_real.grc]] illustrates amplitude modulation using only real blocks (excepted for bits source). As a consequence, the maximum carrier frequency is limited to several tens of kHz.  
* study the modulator part which simply multiply the baseband signal and the sine carrier  * study the modulator part which simply multiply the baseband signal and the sine carrier  
* look at the influence of the carrier frequency on the modulated signal spectrum (carrier frequency must stay lower than half the sampling rate)  * look at the influence of the carrier frequency on the modulated signal spectrum (carrier frequency must stay lower than half the sampling rate)  
−  * look at the spectrum shape for sawtooth input and random bit sequence (QT  +  * look at the spectrum shape for sawtooth input and random bit sequence (QT GUI chooser and selector) 
−  * When transmitting random bits, you can  +  * When transmitting random bits, you can deactivate the interpolating FIR Filter and replace it by a root raised cosine filter 
−  == Spectrum properties of signals==  +  == Spectrum properties of signals == 
Amplitude spectrum is calculated using the Fourier Transform. It represents how the power is spread in the frequency domain. It allows for determining the signal bandwidth. Power Spectral Density or PSD correspond to the average magnitude of the Amplitude spectrum.  Amplitude spectrum is calculated using the Fourier Transform. It represents how the power is spread in the frequency domain. It allows for determining the signal bandwidth. Power Spectral Density or PSD correspond to the average magnitude of the Amplitude spectrum.  
−  In this section we summarize some properties of the phase arg''{X(f)}'' and magnitude ''X(f  +  In this section we summarize some properties of the phase arg''{X(f)}'' and magnitude ''X(f)''. We first consider properties for continuous signal. Then we will investigate additional properties of sampled signal (those used in GNURadio). 
−  Given a signal ''x(t)  +  Given a signal ''x(t)'' it amplitude/phase spectrum is denoted ''X(f)'' which is a complex function given by : 
: <math>X(f) =\int{x(t)e^{2j\pi ft}}dt</math>  : <math>X(f) =\int{x(t)e^{2j\pi ft}}dt</math>  
Line 112:  Line 112:  
When the maximum frequency of the signal spectrum do not respect Nyquist theorem, one should filter the signal with a low pass filter having a cuttoff frequency lower then ''F<sub>s</sub>''/2 before sampling: this correspond to the antialiasing filter used in every SDR hardware.  When the maximum frequency of the signal spectrum do not respect Nyquist theorem, one should filter the signal with a low pass filter having a cuttoff frequency lower then ''F<sub>s</sub>''/2 before sampling: this correspond to the antialiasing filter used in every SDR hardware.  
−  == Complex  +  == Complex envelope, equivalent baseband signal== 
Baseband signals have a spectrum at low frequency near 0 Hz. Audio, video and NRZ line code are baseband signals.  Baseband signals have a spectrum at low frequency near 0 Hz. Audio, video and NRZ line code are baseband signals.  
Line 118:  Line 118:  
Bandpass signals have no energy near 0 Hz and a spectrum located near a high frequency (generally the carrier frequency). Analog and digital AM PM and FM modulated signals are bandpass signals.  Bandpass signals have no energy near 0 Hz and a spectrum located near a high frequency (generally the carrier frequency). Analog and digital AM PM and FM modulated signals are bandpass signals.  
−  A theorem ([[#ancre1[1]]],[[#ancre2[2]]],[[#ancre3[3]]]) states that any high frequency bandpass signal having a limited bandwidth ''B'' can be represented by a baseband equivalent signal having the same bandwidth. This baseband equivalent signal also called the complex envelope is used in simulators since  +  A theorem ([[#ancre1[1]]],[[#ancre2[2]]],[[#ancre3[3]]]) states that any high frequency bandpass signal having a limited bandwidth ''B'' can be represented by a baseband equivalent signal having the same bandwidth. This baseband equivalent signal also called the complex envelope is used in simulators since it allows to lower sampling rate as compared to directly sampling the bandpass signal. 
−  The equivalent baseband representation  +  The equivalent baseband representation helps us for the simulation of bandpass signals. At this step we need some math. We will consider a carrier modulated in phase and/or amplitude (in the sake of simplicity, Frequency modulation is not considered but it can be related to phase modulation.). Such a modulated signal ''m(t)'' and it's complex representation <math>\tilde{m}(t)</math> is : 
: <math>m(t)=a(t) \cos(2\pi F_0t + \phi(t))</math>  : <math>m(t)=a(t) \cos(2\pi F_0t + \phi(t))</math>  
: <math>\tilde{m}(t)=a(t) e^{j(2\pi F_0t + \phi(t))} = a(t) e^{j \phi(t)} e^{j2\pi F_0t} = m^{bb}(t) e^{j2\pi F_0t}</math>  : <math>\tilde{m}(t)=a(t) e^{j(2\pi F_0t + \phi(t))} = a(t) e^{j \phi(t)} e^{j2\pi F_0t} = m^{bb}(t) e^{j2\pi F_0t}</math>  
−  For modulated signal, the complex representation is obtained by replacing the cos function by an exponent function . For a more general definition see [[#ancre1[1]]],[[#ancre2[2]]],[[#ancre3[3]]] . The real signal  +  For modulated signal, the complex representation is obtained by replacing the cos function by an exponent function . For a more general definition see [[#ancre1[1]]],[[#ancre2[2]]],[[#ancre3[3]]] . The real signal corresponds to the real part of the complex signal <math>m(t)=\text{Re}(\tilde{m}(t))</math>. 
[[File:IQ_complex_tutorial_EQ_BB.pngthumb400pxAM spectrum]]  [[File:IQ_complex_tutorial_EQ_BB.pngthumb400pxAM spectrum]]  
Line 139:  Line 139:  
:<math>M^{bb}(f)=M^+(f+F_0)</math>  :<math>M^{bb}(f)=M^+(f+F_0)</math>  
−  So the spectrum of the complex  +  So the spectrum of the complex envelope is a baseband signal whose spectrum has the same shape as <math>=M+(f)</math>. For this reason, knowing <math>\tilde{m}(t)</math> or <math>M^{bb}(f)</math> is sufficient to reconstruct <math>m(t)</math> or <math>M(f)</math>. 
−  === Equivalent baseband,  +  === Equivalent baseband, Envelope, Complex signals ? === 
Terms '''equivalent baseband signal''', '''complex envelope''' and '''complex signal''' can be seen as equivalent terms referring to the same thing.  Terms '''equivalent baseband signal''', '''complex envelope''' and '''complex signal''' can be seen as equivalent terms referring to the same thing.  
Line 148:  Line 148:  
* every bandpass signal must be represented by their equivalent baseband complex signal (excepted for systems having very low carrier frequency)  * every bandpass signal must be represented by their equivalent baseband complex signal (excepted for systems having very low carrier frequency)  
−  So in a gnuradio flowgraph, there is no ambiguity: every complex signal (  +  So in a gnuradio flowgraph, there is no ambiguity: every complex signal (blue interconnections) is implicitly an equivalent representation of a band pass signal so we will simply call it a '''complex signal'''. 
== IQ modulator and demodulator==  == IQ modulator and demodulator==  
Line 186:  Line 186:  
: <math>m^{bb}(t) = A e^{j(2\pi\Delta f t+ \phi)} = A e^{j 2\pi \Delta ft} e^{j\phi}</math>  : <math>m^{bb}(t) = A e^{j(2\pi\Delta f t+ \phi)} = A e^{j 2\pi \Delta ft} e^{j\phi}</math>  
−  The complex envelope of the carrier itself is found for ''Δf''=0 and ''φ''=0 which yields <math>m^{bb}(t) = A</math>. We conclude that in a GNURadio flowgraph, the carrier is represented by a continuous components, a pure DC signal ; this may  +  The complex envelope of the carrier itself is found for ''Δf''=0 and ''φ''=0 which yields <math>m^{bb}(t) = A</math>. We conclude that in a GNURadio flowgraph, the carrier is represented by a continuous components, a pure DC signal ; this may seem counter intuitive. The spectrum <math>M^{bb}(f)</math> is a single peak at ''f=0'' which can be represented using the Dirac ''δ(f) function (or distribution)'' : <math>M^{bb}(f)=\delta(f))</math>. Shifting this spectrum of <math>+F_0</math> towards positive frequency we get the positive part of the carrier spectrum (a peak at <math>+F_0</math>) : <math>M^+(f)=\delta(fF_0))</math>. The negative part of the spectrum is simply obtained by symmetry of the real part (a peak at <math>F_0</math>). 
This can be simulated with GNURadio flowgraph [[media:IQ_tutorial_eq_bb.grcIQ_tutorial_eq_bb.grc]]. The spectrum of our carrier is centered at 0 Hz. The Frequency sink has a feature to shift this spectrum around <math>F_0</math> which is a parameter of the sink. In a simulation, it is not necessary to represent the negative part of the spectrum since ''m(t'') being real, it spectrum is obviously symmetric.  This can be simulated with GNURadio flowgraph [[media:IQ_tutorial_eq_bb.grcIQ_tutorial_eq_bb.grc]]. The spectrum of our carrier is centered at 0 Hz. The Frequency sink has a feature to shift this spectrum around <math>F_0</math> which is a parameter of the sink. In a simulation, it is not necessary to represent the negative part of the spectrum since ''m(t'') being real, it spectrum is obviously symmetric.  
Line 192:  Line 192:  
We will now consider ''Δf'' ≠0 which simulate a signal not exactly synchronous to the carrier. This yieds  We will now consider ''Δf'' ≠0 which simulate a signal not exactly synchronous to the carrier. This yieds  
: <math>m^{bb}(t) = A e^{j 2\pi \Delta ft}</math>  : <math>m^{bb}(t) = A e^{j 2\pi \Delta ft}</math>  
−  The complex  +  The complex envelope is rotating vector (you can simulate this with ''Δf''=1 Hz giving a vector which rotate at 60 rpm or 1 turn per second) , its spectrum is a single peak at ''f=+Δf''. This complex signal exhibits a non symmetric spectrum (no peak at ''f=Δf''). Change ''Δf'' to 0.5 Hz, the vector now rotates counter clockwise at 30 rpm or 0.5 turn per second. 
−  +  Exercise:  
Open flowgraph [[media:IQ_tutorial_eq_bb.grcIQ_tutorial_eq_bb.grc]]. Parameter delta_f is set with an increment of 1/12, which correspond to 5 rotation per minute.  Open flowgraph [[media:IQ_tutorial_eq_bb.grcIQ_tutorial_eq_bb.grc]]. Parameter delta_f is set with an increment of 1/12, which correspond to 5 rotation per minute.  
* For ''Δf''=1/12=0.0833, what is the speed of rotation of the complex signal?  * For ''Δf''=1/12=0.0833, what is the speed of rotation of the complex signal?  
Line 218:  Line 218:  
* the upper one uses real signals. It is the exact AM modulator uses at the beginning of this tutorial.  * the upper one uses real signals. It is the exact AM modulator uses at the beginning of this tutorial.  
** sampling frequency is 200 kHz, 40 times the input rate which equal 5 kHz.  ** sampling frequency is 200 kHz, 40 times the input rate which equal 5 kHz.  
−  ** allowing a maximum carrier frequency close to  +  ** allowing a maximum carrier frequency close to 100kHz 
[[File:IQ complex tutorial AM TX complex.pngthumb600pxAM modulator flowgraph]]  [[File:IQ complex tutorial AM TX complex.pngthumb600pxAM modulator flowgraph]]  
Line 315:  Line 315:  
So we observe that the equivalent filter is a lowpass filter.  So we observe that the equivalent filter is a lowpass filter.  
−  As <math>H(f)</math> is not necessarily symmetric around ''F<sub>0</sub>'', <math>H^{bb}(f</math> can be unsymmetric: this correspond to a complex time transfert function, what we will call a complex filter.  +  As <math>H(f)</math> is not necessarily symmetric around ''F<sub>0</sub>'', <math>H^{bb}(f)</math> can be unsymmetric: this correspond to a complex time transfert function, what we will call a complex filter. 
So the baseband equivalent of a band pass filter is a complex filter acting on a complex signal.  So the baseband equivalent of a band pass filter is a complex filter acting on a complex signal.  
Line 377:  Line 377:  
=== GNURadio XLating filter ===  === GNURadio XLating filter ===  
[[File:IQ_tutorial_QPSK_TX_RX_2.pngthumb800pxBasic Tx/Rx using a Xlating filter at receiver]]  [[File:IQ_tutorial_QPSK_TX_RX_2.pngthumb800pxBasic Tx/Rx using a Xlating filter at receiver]]  
−  GNURadio XLating filter perform  +  GNURadio XLating filter can perform the following actions 
−  *  +  * It can shift the spectrum in the frequency domain 
−  *  +  * It can filter the result with the specified filter 
−  *  +  * It can decimate the signal 
−  The Xlating filter is  +  The Xlating filter is useful every time a signal spectrum is not centered, and/or when you need to select one signal in a spectrum where several channel are in use. 
Open [[Media:IQ_tutorial_QPSK_TX_RX_2.grcIQ_tutorial_QPSK_TX_RX_2.grc]].  Open [[Media:IQ_tutorial_QPSK_TX_RX_2.grcIQ_tutorial_QPSK_TX_RX_2.grc]]. 
Latest revision as of 02:42, 26 October 2021
This tutorial originates from discussions on discussgnuradio@gnu.org. We will explain why simulating digital communications requires equivalent baseband representation of signalswhich in fact are complex signals. For this reason, complex signals are essential in GNURadio.
This tutorial is also intended for nonspecialists, as it involves as little maths as possible while presenting most results using GNURadio's flowgraph. Some examples involving simple modulation schemes used in HAM radio are presented. While introducing complex signals can be seen as increasing complexity, we will see that it drastically simplifies the understanding of certain concepts, such as synchronization.
If you are searching for more detailed information, please refer to the literaturesuch as references [1],[2],[3].
Contents
 1 Some maths
 2 Why we need complex and IQ signals
 3 Spectrum properties of signals
 4 Complex envelope, equivalent baseband signal
 5 IQ modulator and demodulator
 6 Some examples of EqBB signals
 7 Equivalent baseband representation
 8 Tx/Rx PSK equivalent baseband simulation
 9 References
 10 About figures
Some maths[edit]
This section summarizes complex number properties used in this tutorial. More information can be found on complex number Wikipedia page.
A complex number is a number of the form a + jb, where a and b are real numbers, and j is an indeterminate satisfying j^{2}=1 (Mathematician prefer using i instead of j used by physicist and radio engineers). For example, z_{1}=2+3j is a complex number. The real part Re{z} of z_{1} is 2 and its imaginary part Im{z} is 3.
Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle z=a+jb } Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \text{Re}\{z\}=a} Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \text{Im}\{z\}=b}
Complex numbers can be represented in the complex plane as vectors. The modulus or magnitude r of a complex number z = a + jb is
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle r=z=\sqrt{a^2+b^2}}
The phase φ of z (referred to as the argument) is the angle of the radial Oz on the positive real axis.
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \phi=\arg(z)=\arctan(b/a) } (for a≠0)
Together, r and φ provide another means of representing complex numbersboth the polar and exponential forms.
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle z=r \left(cos(\phi) + j sin(\phi) \right) = r e^{j\phi}}
The exponential form is convenient for computing the multiplication of two complex numbers.
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle z_1= r_1 e^{j\phi_1}}
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle z_2= r_2 e^{j\phi_2}}
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle z=z_1z_2= r_1r_2 e^{j(\phi_1+\phi_2)}}
The following complex numbers have a unit magnitude r=1 :
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle +1=e^{j0}}
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle +j=e^{j\pi/2}}
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle 1=e^{j\pi}}
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle j=e^{j3\pi/2} }
A complex signal c(t) can be seen as two real signals a(t), b(t)often written as i(t), q(t)and combined to create a complex signal. It can also be represented by its amplitude over time r(t) as well as its phase variation over time φ(t)
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle c(t) = a(t) + j b(t) = r(t) e^{j\phi (t)} }
Why we need complex and IQ signals[edit]
GNURadio software is mainly used to design and study radio communications. Making high frequency transmission requires modulating a high frequency carrier at frequency F_{0}. The most common modulation for analog transmissions are: amplitude modulation (AM), phase modulation (PM), and frequency modulation (FM).
For analog AM, the modulated signal m(t) is simply the mathematical product of the carrier c(t) and the baseband signal a(t). The corresponding hardware is a mixer whose scheme and mathematical representation is a multiplier.
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle m(t) = a(t) c(t) = a(t) \cos(2\pi f_0t)}
We call a(t) a baseband signal since its spectrum is in a low frequency rangestarting near 0 Hz (e.g. [020kHz] for a HiFi audio signal).
The spectrum of an AM modulated signal M(f) is the translation or the audio spectrum A(f) around ±F_{0} with A(f) being the entire spectrum of the modulating signal, using both positive and negative frequencies
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle M(f) = \frac{1}{2}\big(A(ff_0) + A(f+f_0)\big)}
N.B. Negative frequencies are often omitted in spectrum representation since, for real signal (a(t), m(t) are real) the power spectrum are symmetric around zero (more details on this later).
Up to now we have been dealing with real signals. The need for complex signals appears in the next step. Simulation requires sampled signal. Sampling is the operation of observing a continuous signal and taking a finite number of samples at a given sampling rate f_{s} (i.e. one sample each 1/f_{s} second). Because a simulator can only make calculations on a finite number of samples, it requires a sampled signal. Nyquist Sampling theorem states that the sampling rate must be greater than twice the maximum frequency F_{Max} in order to reconstruct the original signal from the sampled signal.
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle f_s > 2F_{Max}}
For a HIFI audio signal, the maximum audio frequency Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle F_{Max Audio}} is close to 20 kHz, so the sampling rate must be higher than 40 kHz (44.8 kHz is often used in computer sound cards, 8 kHz is used for mobile phones since voice has a lower frequency range than HIFI audio).
For an AM signal modulated by an audio signal, the maximum frequency of the modulated spectrum is Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle F_{Max}=F_0+F_{Max Audio}} . Direct sampling of such a signal is not possible with conventional hardware such as a low cost SDR dongle. If the carrier frequency is close to 1 GHz, the sampling rate should be at least 2 GHz. This is obviously too much for the computer to handle (higher than some CPU clocks).
Flowgraph IQ_tutorial_AM_TX_real.grc illustrates amplitude modulation using only real blocks (excepted for bits source). As a consequence, the maximum carrier frequency is limited to several tens of kHz.
 study the modulator part which simply multiply the baseband signal and the sine carrier
 look at the influence of the carrier frequency on the modulated signal spectrum (carrier frequency must stay lower than half the sampling rate)
 look at the spectrum shape for sawtooth input and random bit sequence (QT GUI chooser and selector)
 When transmitting random bits, you can deactivate the interpolating FIR Filter and replace it by a root raised cosine filter
Spectrum properties of signals[edit]
Amplitude spectrum is calculated using the Fourier Transform. It represents how the power is spread in the frequency domain. It allows for determining the signal bandwidth. Power Spectral Density or PSD correspond to the average magnitude of the Amplitude spectrum.
In this section we summarize some properties of the phase arg{X(f)} and magnitude X(f). We first consider properties for continuous signal. Then we will investigate additional properties of sampled signal (those used in GNURadio).
Given a signal x(t) it amplitude/phase spectrum is denoted X(f) which is a complex function given by :
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle X(f) =\int{x(t)e^{2j\pi ft}}dt}
continuous real signal[edit]
Every real signal have a spectrum whose magnitude is symmetric and phase is antisymmetric.
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle x(t) \in \mathbb{R}}
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle X(f)=X^*(f)}
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle X(f)=X(f)}
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \text{arg}\{X(f)\}=\text{arg}\{X(f)\}}
continuous complex signal[edit]
The main difference with real signal is that:
 any complex signal having non null imaginary part exhibits a nonsymmetric spectrum.
 as a consequence, every nonsymmetric spectrum correspond to a complex signal
sampled signals[edit]
We consider a signal x(t)) and we note its sampled version x_{s}(t)) sampled at frequency F_{s}.
The spectrum X_{s}(f) of the sampled signal is a periodic function of period F_{s}.
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle X_s(f)=\sum_k X(fkF_s)}
So the sampled signal spectrum verify :
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle X_s(f+kF_s)=X_s(f)}
Generally the bandwidth of X(f)) is lower then F_{s}/2. The infinite sum defined above exhibit no aliasing (no superposition of patterns X(f), X(f+F_{s}) and X(fF_{s})) .In that case, as stated in the Nyquist theorem of sampling, the original spectrum/signal can be recovered by filtering the sampled signal.
When the maximum frequency of the signal spectrum do not respect Nyquist theorem, one should filter the signal with a low pass filter having a cuttoff frequency lower then F_{s}/2 before sampling: this correspond to the antialiasing filter used in every SDR hardware.
Complex envelope, equivalent baseband signal[edit]
Baseband signals have a spectrum at low frequency near 0 Hz. Audio, video and NRZ line code are baseband signals.
Bandpass signals have no energy near 0 Hz and a spectrum located near a high frequency (generally the carrier frequency). Analog and digital AM PM and FM modulated signals are bandpass signals.
A theorem ([1],[2],[3]) states that any high frequency bandpass signal having a limited bandwidth B can be represented by a baseband equivalent signal having the same bandwidth. This baseband equivalent signal also called the complex envelope is used in simulators since it allows to lower sampling rate as compared to directly sampling the bandpass signal.
The equivalent baseband representation helps us for the simulation of bandpass signals. At this step we need some math. We will consider a carrier modulated in phase and/or amplitude (in the sake of simplicity, Frequency modulation is not considered but it can be related to phase modulation.). Such a modulated signal m(t) and it's complex representation Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \tilde{m}(t)} is :
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle m(t)=a(t) \cos(2\pi F_0t + \phi(t))}
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \tilde{m}(t)=a(t) e^{j(2\pi F_0t + \phi(t))} = a(t) e^{j \phi(t)} e^{j2\pi F_0t} = m^{bb}(t) e^{j2\pi F_0t}}
For modulated signal, the complex representation is obtained by replacing the cos function by an exponent function . For a more general definition see [1],[2],[3] . The real signal corresponds to the real part of the complex signal Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle m(t)=\text{Re}(\tilde{m}(t))} .
One important property of Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \tilde{m}(t)} spectrum Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \tilde{M}(f)} is that it has only energy in the positive frequency range and verify.
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \tilde{M}(f)=M^+(f)}
where Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle =M^+(f)} denotes the restriction of Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle =M(f)} to the positive frequency range.
Let us now look at the complex envelope or equivalent baseband signal Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle m^{bb}(t)} of bandpass signal Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle m(t)} defined by :
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle m^{bb}(t)= \tilde{m}(t) e^{j2\pi F_0t} = a(t) e^{j \phi(t)} }
Multiplying a signal by Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle e^{+j2\pi F_0t}} correspond to a frequency translation of the spectrum so that we have:
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle M^{bb}(f)=M^+(f+F_0)}
So the spectrum of the complex envelope is a baseband signal whose spectrum has the same shape as Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle =M+(f)} . For this reason, knowing Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \tilde{m}(t)} or Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle M^{bb}(f)} is sufficient to reconstruct Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle m(t)} or Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle M(f)} .
Equivalent baseband, Envelope, Complex signals ?[edit]
Terms equivalent baseband signal, complex envelope and complex signal can be seen as equivalent terms referring to the same thing.
While simulating some radio we have mainly two type of signals:
 any low frequency or baseband signal are real signal, they are represented by real signals
 every bandpass signal must be represented by their equivalent baseband complex signal (excepted for systems having very low carrier frequency)
So in a gnuradio flowgraph, there is no ambiguity: every complex signal (blue interconnections) is implicitly an equivalent representation of a band pass signal so we will simply call it a complex signal.
IQ modulator and demodulator[edit]
Let us now come to hardware and SDR and first rewrite the equivalent baseband signal and the modulated signal m(t) :
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle m^{bb}(t)=a(t) e^{j \phi(t)} =i(t) + j q(t)}
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle m(t)=\text{Re} \left[ \big(i(t)+jq(t)\big) e^{j2\pi F_0t} \right]}
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle m(t)=i(t) \cos(2\pi F_0t) q(t) \sin(2\pi F_0t)}
The phase φ(t) of the modulated signal m(t), is identical to the phase of the complex signal c(t)=i(t)+jq(t). The equivalent baseband signal c(t) is represented in a complex plane also refeered to as the IQ plane. The resulting m(t) can be any modulated in AM, PM or even FM signal.
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle i(t)=a(t) \cos(\phi(t))}
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle q(t)=a(t) \sin(\phi(t))}
As a result, the modulated signal m(t) is the addition of :
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle i(t) \cos(2\pi F_0t)} which is an AM modulated signal, the product of i(t) by a signal In phase with the carrier (i stand for In phase)
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle q(t) \sin(2\pi F_0t)} which is an AM modulated signal, the product of q(t) by a signal in Quadrature with the carrier (q stand for Quadrature)
The corresponding hardware is called an IQ modulator. Every modern radio communication uses IQ modulator for emitting and IQ demodulator for receiving. The IQ demodulator is able to recover incoming i(t) and q(t). If the amplitude of the recovered carrier is 2, and if modulator and demodulator carrier are synchronous (same frequency and phase) the output of the IQ demodulator correspond to input i(t) and q(t).
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \hat{i}(t)=i(t) }
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \hat{q}(t)=q(t) }
In real hardware, carrier are not synchronous and the receiver must compensate any phase and frequency difference between emitter and receiver. This is done using some hardware and/or software such as polyphase clock sync, and Costas loop.
SDR Module such as USRP N320 block Diagram) and SDR Dongle (RTL2832) input and output are the 2 real signals i(t) and q(t) combined to form the complex signal i(t) + j q(t) which turns to be the equivalent baseband of the modulated emitted or received signal. These hardware are based on IQ modulator and IQ demodulator associated with mixers when intermediate frequency (IF) is used.
Some examples of EqBB signals[edit]
In order to get familiar with complex signal, let us consider some basic examples.
First, we suppose our emitter carrier is Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \cos (2\pi F_0t)} so that every equivalent baseband signal will be defined according to this reference.
complex envelope of a pure sine wave[edit]
We will consider a pure sine wave, close to the carrier having a Δf frequency shift and φ phase shift as compared to the carrier. After some math we get its complex equivalent signal.
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle m(t) = A \cos (2\pi (F_0+\Delta f)t+ \phi)}
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \tilde{m}(t) = A e^{j(2\pi (F_0+\Delta f)t + \phi)} }
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle m^{bb}(t) = A e^{j(2\pi\Delta f t+ \phi)} = A e^{j 2\pi \Delta ft} e^{j\phi}}
The complex envelope of the carrier itself is found for Δf=0 and φ=0 which yields Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle m^{bb}(t) = A} . We conclude that in a GNURadio flowgraph, the carrier is represented by a continuous components, a pure DC signal ; this may seem counter intuitive. The spectrum Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle M^{bb}(f)} is a single peak at f=0 which can be represented using the Dirac δ(f) function (or distribution) : Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle M^{bb}(f)=\delta(f))} . Shifting this spectrum of Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle +F_0} towards positive frequency we get the positive part of the carrier spectrum (a peak at Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle +F_0} ) : Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle M^+(f)=\delta(fF_0))} . The negative part of the spectrum is simply obtained by symmetry of the real part (a peak at Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle F_0} ).
This can be simulated with GNURadio flowgraph IQ_tutorial_eq_bb.grc. The spectrum of our carrier is centered at 0 Hz. The Frequency sink has a feature to shift this spectrum around Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle F_0} which is a parameter of the sink. In a simulation, it is not necessary to represent the negative part of the spectrum since m(t) being real, it spectrum is obviously symmetric.
We will now consider Δf ≠0 which simulate a signal not exactly synchronous to the carrier. This yieds
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle m^{bb}(t) = A e^{j 2\pi \Delta ft}}
The complex envelope is rotating vector (you can simulate this with Δf=1 Hz giving a vector which rotate at 60 rpm or 1 turn per second) , its spectrum is a single peak at f=+Δf. This complex signal exhibits a non symmetric spectrum (no peak at f=Δf). Change Δf to 0.5 Hz, the vector now rotates counter clockwise at 30 rpm or 0.5 turn per second.
Exercise: Open flowgraph IQ_tutorial_eq_bb.grc. Parameter delta_f is set with an increment of 1/12, which correspond to 5 rotation per minute.
 For Δf=1/12=0.0833, what is the speed of rotation of the complex signal?
 What do you observe when Δf=1/12=0.0833 ?
 Slowly increase Δf to reach f_{s}/2 and observe the spectrum really has a single peak at Δf. Explain your observation when Δf>f_{s}/2'.
 Do the same for a negative Δf
 For Δf =f_{s} what is the equivelant baseband frequency. What is the carrier frequency ?
 Set Δf=0 and φ≠0. Discusss the simulated equivalent baseband signal.
AM mod demod example[edit]
This example will consider signal baseband signal a(t) modulating a carrier at F_{0} in AM, and its demodulation. As no phase modulation in used, φ(t)=0 and consequently q(t)=0.
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle m(t) = a(t) \cos (2\pi F_0 t)=i(t) \cos (2\pi F_0t) q(t) \sin (2\pi F_0t) }
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle i(t) = a(t) }
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle q(t) = 0}
AM modulation is a special case for which the equivalent baseband complex signal has a null imaginary part and is real. Considering the schematic diagram of an IQ modulator demodulator, when q(t)) is null the diagram is simplified (imaginary path is not used) yielding the well known AM modulation/demodulation scheme.
Remind that in GNURadio flowgraph :
 orange connections correspond to real signals (float numbers)
 blue connections correspond to complex signals (complex numbers)
Flowgraph IQ_tutorial_AM_TX_complex.grc contains two equivalent diagram for an AM modulation with a sawtooth input:
 the upper one uses real signals. It is the exact AM modulator uses at the beginning of this tutorial.
 sampling frequency is 200 kHz, 40 times the input rate which equal 5 kHz.
 allowing a maximum carrier frequency close to 100kHz
 the lower one uses an equivalent baseband representation.
 sampling frequency is 25 kHz, 5 times the input rate which equal 5 kHz.
 the sawtoooth correspond to identical generator in both modulator
 each blue input or output is the baseband equivalent of the corresponding signal in the upper AM modulator.
 the carrier frequency can be any value compatible with connected Hardware
 the carrier equivalent signal equal 1 (as stated in the previous section) so it has been disable and replaced by a complex constant
 the Hardware input is the complex equivalent baseband signal
 the carrier frequency is not needed nor used in complex blocks; excepted in the QT GUI spectrum to label the center frequency which is 0 but correspond to the F>sub>0</sub>.
Three blocks are unusefull and can be removed from the lower complex modulator:
 save the current flowgraph as IQ_tutorial_AM_TX_complex_2.grc.
 remove the complex multiplier, the carrier equivalent baseband (complex constant=1) and the carrier complex source (the disabled one). Reconnect complex to float and throttle blocks to obtain the flowgraph sketched on the right.
You can now run this flowgraph and compare signal and their spectrum in both modulator. Once again, these simulations suppose perfectly synchronous emitter and receiver carrier which is quite far from reality.
Further work : construct the AM demodulator flowgraph[edit]
Use the flowgraph IQ_tutorial_AM_TX_complex_2.grc that you created, add blocks to perform AM demodulation and to recover the input signal a(t) from the modulated signal. You have to use the equivalent baseband representation of the demodulator.
1st indication 
Remind and use the relation between a(t) and c(t)=i(t)+jq(t) given above. 
2nd indication 
An AM demodulator extract the amplitude (magnitude) of the modulated signal... 
Solution including filter 
IQ_tutorial_AM_TX_complex_3.grc
Running this flowgraph, demodulation is obtained taking the real part (imperfect solution), or the magnitude (good solution) of the complex signal.

QPSK example[edit]
QPSK digital signal exhibit four phase state Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \phi \in \{\pi/4, 3\pi/4, 3\pi/4, \pi/4 \}} .
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle m^{bb}(t)=a(t) e^{j \phi(t)} =i(t) + j q(t)}
And the baseband equivalent signal also exhibit 4 different values each one being used to code a 2 bits sequence 00 01 10 or 11 :
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle m^{bb}(t) \in \{1+j , 1+j , 1j, 1j \}}
Normally, we would use a GNURadio "constellation modulator" to simulate QPSK as is done in the excellent Guided Tutorial on PSK Demodulation.
For the present tutorial we will simulate a QPSK without Nyquist filter in order to get phase states which can be simply displayed on a constellation sink. This is not possible with constellation modulator. Our QPSK modulator (complex representation) is build taking into account that the complex signal exhibit 4 different values, its obvious that both i(t) and q(t) have only 2 states so they are binary symmetric NRZ line codes:
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle i(t), q(t) \in \{+1, 1\}}
Flowgraph IQ_tutorial_QPSK.grc generates 2 sequences of bits, interpolates them to get 2 binary symmetric NRZ line codes. The NRZ signals are combined to create the complex equivalent baseband signal of the QPSK which can be transmitted to any SDR emitter.
Simulate this flowgraph :
 stop the QT GUI spectrum to observe that the complex baseband signal spectrum is no longer symmetric as expected for complex signals.
 use spectrum averaging to see that despite of the previous observation, the power spectral density (average of the magnitude spectrum) is symmetric around 0 (which correspond to F_{0} for the modulated signal.
 Disable the interpolating filters and enable both root raised cosine filter (the filter used in every QPSK emitter). This yields the real spectrum of a QPSK.
Equivalent baseband representation[edit]
This diagram sketch a classical Emitter/Receiver (Tx/Rx) transmission including channel noise, and its equivalent baseband representation which could be used for a GNURadio simulation.
 this transceiver can be used to generate and transmit any modern digital communications like OOK, ASK, PSK, and QAM depending on choosen signal i(t) and q(t)
 quantities with an hat like Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \hat{i}(t)} should be similar or equal to corresponding Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle i(t)}
 signal i(t) and q(t) are generated using Dirac impulse waited by amplitudes a_{k} and b_{k} and a shaping filter h_{1}(t)
 the considered channel is Average Wait Gaussian Noise (AWGN)
 ID modulator and IQ demodulator are not necessarily synchronized
 Baseband filter are used to limit the bandwidth in the emitter and limit noise in the receiver. In a well construct Transceiver chain, h_{1}(t) and h_{3}(t) should be Root Nyquist filters
 A Bandpass filter is used in the channel, it can represent the channel effect as well as any additional filter used on the modulated signal
One may observe that this transceiver don't include non linear effect suchs as amplifier intermodulation. In fact, complex baseband representation don't permit precise modelization of non linear effects so they are not considered here. Complex signals on the baseband equivalent representation are represented using double arrow.
Every linear band limited system has an equivalent baseband which is build using the following rules.
 Replace IQ modulator inputs i(t) and q(t) by a complex signal i(t) + jq(t)
 Similarly replace IQ demodulator outputs by a complex signal
 Keep any baseband filter acting on baseband signal unchanged (filter h_{1}(t) is acting on i(t) and q(t) so it can be replaced by a single filter acting on complex signal i(t) + jq(t). However one could have used two identical filters each acting on one real signal)
 Replace IQ modulator by a multiplication by a (the modulator carrier is used as a reference to define complex equivalent baseband, no multiplier if a=1)
 Replace IQ demodulator by a multiplication by Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle b e^{j(2\pi \Delta ft+\phi)}}
(no multiplier if b=1 and demodulator is synchronized to modulator
 This result from section complex envelope of a pure sine wave
 Replace any bandpass filter by its equivalent baseband complex filter as defined below
 Replace channel bandpass noise by its equivalent baseband complex noise as defined below
Bandpass filter[edit]
Any bandpass filter with frequency transfert function Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle H(f)} having a limited bandwidth can be represented by an equivalent baseband filter Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle H^{bb}(f)} . The baseband filter frequency transfert is the positive part of the transfert function shifted toward 0 (same process as above for AM Spectrum)
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle H^{bb}(f)=H^+(f+F_0)}
So we observe that the equivalent filter is a lowpass filter.
As Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle H(f)} is not necessarily symmetric around F_{0}, Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle H^{bb}(f)} can be unsymmetric: this correspond to a complex time transfert function, what we will call a complex filter.
So the baseband equivalent of a band pass filter is a complex filter acting on a complex signal.
Normally, when filtering complex signal in GNURadio, in most situation complex taps must be used. In case your baseband filter is symmetric around F_{0} it turns to be a real filter, it can be represented using real taps.
Unsynchronized demodulator[edit]
For a receiver carrier p'(t) given by
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle m(t) = 2b \cos (2\pi (F_0+\Delta f)t+ \phi)}
It is found that the equivalent baseband is a multiplication with
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle m^{bb}(t) = b e^{2j(\pi (\Delta ft+\phi)}}
Which is similar (excepted for a factor 2) to the result given for the baseband equivalent of a pure sine wave close to the carrier. The factor 2 difference come from the demodulation process.
Channel noise[edit]
Any bandpass noise Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle N(t)} having a limited bandwidth can be represented by an equivalent baseband noise Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle N^{bb}(t)} . The baseband equivalent noise spectrum is the positive part of the bandpass noise spectrum shifted toward 0 (same process as above for AM Spectrum and for filter)
 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle N^{bb}(f)=N^+(f+F_0)}
So we find that the baseband equivalent noise is a low frequency noise. Furthermore, as for filters, the baseband equivalent noise is complex, its real part and imaginary part having the same variance (power).
Tx/Rx PSK equivalent baseband simulation[edit]
In this section we will illustrate equivalent baseband blocks introduced above:
 complex noise
 complex filters
 IQ demodulator with carrier asynchronism,
This will be done using a simple QPSK and BPSK transceiver simulation. We will not really investigate demodulation but concentrate on what should be done to compensate for the channel impairments.
Let us first examine this flowgraph. The upper part of the flowgraph generate a QPSK signal as used in a previous flowgraph. The lower part is a modified version of the first one.
Questions :
 If we do not account for the multiplier, what type of signal will generate the second part of this flowgraph (at the throttle output)?
 What is the effect the multiplier (source is at 25 Khz which is 1/4 of the sampling rate) ?
Solution 
the second signal is a BPSK (i(t) is an NRZ Line code, q(t) is 0. The two phase states of this BPSK are 0° and 180°. 
Without multiplier this BPSK would be centered at F_{0}. As it is multiplied by a complex exponent at 25 kHz, it will be shift at F_{0}+ 25 kHz 
Open IQ_tutorial_QPSK_TX_RX.grc. Note that BPSK constellation block is connected before the multiplier, while BPSK spectrum is evaluated after the multiplier.
 Simulate the flowgraph. Adjust Delta_f (BPSK shift) to 0. Observe the constellation and the spectrum of both signals
 Increase noise level, observe the complex noise on BPSK and QPSK constellation
 Change Delta_f (BPSK shift) and observe how the BPSK Spectrum is shifted.
 What is the BPSK center frequency ?
 Explain why the BPSK constellation in this case is rotating
We will now investigate the channel frequency offset parameter. This parameter is used to simulate the frequency offset between a receiver and an emitter.
Stop the simulation. Disable delta_f_over_fs QT Gui range and enabled the one which was disabled (larger range) and run the flowgraph.
 select the spectrum tab, and increase Delta_f (BPSK shift) to 25 kHz
 change delta_f_over_fs value and observe how it shifts the spectrum of the received signal the same way as our multiplier does.
Let's suppose we receive a modulated at the output of an unsynchronized receiver (hardware). Let's suppose that we have measured the carrier frequency difference between emitter end receiver. The modulated signal spectrum is not centered around F_{0}. There is several way to compensate for this effect:
 Specify a receiver frequency which compensate the frequency difference (most SDR Source in GNURadio can specify a frequency shift which is given in PPM (Parts per million).
 Multiply the received signal by Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle e^{2j(\pi (\Delta ft)}}
 Use a GNURadio Xlating filter block which perform the previous multiplication and a filtering.
GNURadio XLating filter[edit]
GNURadio XLating filter can perform the following actions
 It can shift the spectrum in the frequency domain
 It can filter the result with the specified filter
 It can decimate the signal
The Xlating filter is useful every time a signal spectrum is not centered, and/or when you need to select one signal in a spectrum where several channel are in use.
Open IQ_tutorial_QPSK_TX_RX_2.grc.
This flowgraph
 generate a single signal composed of:
 our QPSK signal at F_{0}
 the BPSK signal at F_{0}+25 kHz
 simulate a channel frequency offset
 use a Xlating filter to shift the received signal (compensate the channel and/or select the desired channel)
 filter the signal to select only one signal BPSK or QPSK (low pass with 12 kHz cuttoff frequency)
 note: filtering is performed after Xlating so thaht we can display filtered and unfiltered signals on the same spectrum.
 display the constellation of the demodulated channel (constellation are now different from a perfect constellation , this is due to the low pass filter.
Simulate this flowgraph. By default the QPSK signal is demodulated.
 observe that the constellation is close to the QPSK one (excepted for filter effect, at this point we should use Nyquist filters to recover the QPSK constellation)
 Slowly increase Xlating filter frequency offset and observe the spectrum shift
 Select the Xlating filter frequency offset to demodulate the BPSK (25kHz) and observe how it is uneasy or impossible to get a correct constellation.
 You should get approximately 2 set of points, but these point are shift as compared to the perfect BPSK constellation. This is normal, we compensate frequency while in a real receiver it is necessary to compensate both frequency and phase shift
 In fact simulating a delta_f frequency which change during simulation is equivalent to having a phase and a frequency shift.
Asynchronism in real hardware[edit]
The above simulation have explained the basis of asynchronism found in any hardware Tx/Rx and some basic method to recover synchronism.
However keep in mind that dealing with real hardware is more complicated then described here. The frequency and phase shift between emitter and receiver should be considered as dynamic and changing continously and randomly with time.
As a consequence, we need more robust block to continuously synchronize emitter and receiver. Fortunately, digital signal processing offer many solutions to these impairments. Curious reader are encouraged to read the excellent GNURadio Guided Tutorial on PSK Demodulation.
References[edit]
Further reading for complex equivalent baseband signal:
 [1] Proakis J., Digital Communication, McGraw Hill Series in Electrical and Computer Engineering, Singapore, 1989
 [2] Gallager R., Principles of digital communication, Cambridge University Press Cambridge, UK, 2008
 [3] Benedetto S. and Biglieri E., Principles of digital transmission : with wireless applications, Kluwer Academic/Plenum Publishers, NY, 1999
About figures[edit]
Most figures were generated from .grc flowgraph referenced in the text, and from .odg and .tex file. For completeness, these files are included in the following compressed archive IQ_complex_tutorial_files.zip.grc so that anyone can easily improve this tutorial. If you modify some figure, please update this archive too.