Subsections
Quadrature detection
Quadrature detection is a demodulation technique which builds on the utilization of a quadrature signal. This appendix will introduce quadrature signals in section N.1 and N.2 and proceeds with the different ways these can be used to obtain FM demodulation, see sections N.3, N.4 and N.5.
Theory
The first of the following sections will introduce the mathematics behind quadrature signals. The second will describe how a continous wave modulated signal can be represented by quadrature signals. The reference for this section is [Haykin, 2001, pages 723730].
This section will introduce three new terms; the preenvelope of a signal, the complex envelope of a signal and finally the
and
components of a signal. By this it is shown how to represent a signal at baseband using complex quantities and avoiding information loss normally occuring with direct downconversion.
In a communication system the signal that is physically transmitted is a realvalued bandpass signal,
as shown in figure N.1(a). In handling bandpass signals the preenvelope of
has shown to be particularly useful, but one should remember that the preenvelope is purely a theoretical function. The preenvelope of such signal is defined as



(N.1) 
where:
is the preenvelope of


is a realvalued signal 

is the Hilbert transform of


The Hilbert transform shifts the phase of all negative frequencies in a signal by
and of all positive frequencies by
. The signals
and
are said to be a Hilbert transform pair. Amplitudes are not affected by the Hilbert transform. To sum up; the preenvelope of a signal is nothing but the signal itself as the real part and its Hilbert transform as the imaginary part. The Fourier transform
of
is given by



(N.2) 
where
is the sign of
. Knowing this, the Fourier transform of the preenvelope of
,
can be derived:
From this it is found that the preenvelope has no frequency content for all negative frequencies, and that the magnitude of the positive frequency content is doubled as shown by figure N.1(b). This proporty will show its importance later.
Now consider a bandpass signal,
, centered about the frequency
and limited to the band
. This signal contains a baseband signal, and normally downconverting this to baseband directly would cause sideband overlap, hence information would be lost. The quadrature representaion is complex and avoids this.
The preenvelope of such signal only contains information in the positive frequencies. The preenvelope of such signal can always be expressed as a baseband signal with a frequency displacement of
. The base band signal is called the complex envelope,
.



(N.5) 
where:
is the preenvelope of


is the complex envelope of


The complex frequency shift is obtained by multiplication of the complex signal
conforming with the Fourier transform property:



(N.6) 
Note about the above formulas that the only difference between the complex envelope,
, and the preenvelope,
, is that the complex envelope is shiftet to base band while the preenvelope is still on a carrier. None of the signals have mirrors in the frequency plane. In contrary to direct downconversion, where side band ovelap usually occurs, the quadrature representaion, which can be considered a form of complex downconversion, does not have this problem; i.e the signals can be represented by the complex envelope at baseband without loosing information. This is possible because the complex envelope is a complexvalued function, which will be addressed further in the next section.
Figure N.1:
Illustrating spectrums of a) a received bandpass signal, (b), the preenvelope of the bandpass signal and (c) the complex envelope of the bandpass signal.

While the preenvelope
is bandlimitted to the band
, the complex envelope
is limitted to the band
, and is therefore a lowpass signal. This is illustrated by figure N.1(c). In general,
is a complexvalued lowpass quantity that may be described on rectangular form:



(N.7) 
where:
is the inphase component of


is the quadrature component of


The lowpass property of
and
is inherited from
. The original bandpass signal,
, can be represented also by means of
and
:
To sum up; all information content of
is preserved within the
 and
signals since these are the real and imaginary components of the complex envelope of
. This is a base band representation that avoids sideband overlap, that would normally occur with direct downconversion.
Until now the bandbass signal
has been treated as arbitrary. This section will focus on the quadrature representation of signals that are modulated using AM, PM or FM. In these cases the bandpass signal can be expressed generally as



(N.11) 
where:
is a continuous wave modulated signal 

is the envelope of


is the phase of

[rad] 
The
and
components are derived following the steps presented in the last section:



(N.12) 



(N.13) 



(N.14) 



(N.15) 



(N.16) 
From the above and equation (N.7) it follows that
Note that all the information content is preserved in the complex envelope no matter if it is in terms of
and
or in envelope and phase. The conversion between the two forms can of course be done both ways. Note that in complex envelope,
is not only the envelope, but the actual amplitude. It can therefore be calculated as the absolute length of
. The phase of the signal is simply the angle of the same complex number:
To sum up; The
 and
signals are both lowpass signals, and they both contain both ampltitude and phase information. Usually the signals are used to determine the amplitude and phase of some received signal, i.e.
, and in this context both
and
are required to uniquely determine the phase. Determination of the instantanous phase of a received signal is the key in quadrature FM detection, which will be described in the following sections.
IQ generator
In this section the principle for obtaining the
 and
signals are described. Recalling from section N.1 that the
 and
signals for an FM signal where
is constant are defined as
These are the signals that are to be derived from the FM signal.
In figure N.2 the principle for making the
 and
signals is shown.
Figure N.2:
A block diagram for extracting the I and Qsignals

As seen in the figure, the
 and
signals are made by multiplying the FMsignal with 2
or 2
, and afterwards low pass filtering the signal. How this gives the
 and
signals is shown by the following mathematical description.
Mathematical description of the I and Qsignals
Because the calculations of the
 and
signals are almost identical, only a mathematical description of the
signal is made. The
signal can be calculated by using the same procedure.
If the FMsignal is given as
then the signal after the mixer is given by



(N.23) 
From appendix B.2, it is known that an FM signal can be described as



(N.24) 
Substituting the expression for
into equation N.23 the signal after the mixer can be described as (using Eulers formel)
The desired
signal is the part of the
signal centered around zero. In order to obtain this signal, the
signal is low pass filtered, which gives the
signal



(N.27) 
This shows that the
 and
signal can be derived from the FM signal by using the above described method in an ideal situation. Often this will not be the case because the carrier frequency will have a frequency offset
, and a phase offset
, with respect to the internal oscillator. This gives the following FMsignal



(N.28) 
It can be shown that a variation in the carrier frequency gives the following
 and
signals
This means that a change in the carrier frequency results in a frequency offset of both the
 and
signals.
Similarly it can be shown that a change in the phase of the signal multiplied with the FM signal results in the following
 and
signals.
This shows that a change in the phase gives a phase offset in both the
 and
signals.
How these results influence the demodulation will be described for each of the following demodulation algorithms.
Now that the method for finding the
 and
signals is described, an algorithm that calculates the
 and
signals can be made.
Most af the calculations shown above can directly be implemented as a discrete time function. Some considerations must however be made when designing the low pass filter. This is because different methods can be used in designing a digital filter. For further information on filter design see appendix M.
The MATLAB^{TM} implementation is made by following the method described above and shown in figure N.2. This means that the carrier frequency of the FM signal needs to be known, for the algorithm to work.
A digital oscillator needs to be made in order to generate the sine and cosine signal. In MATLAB^{TM} this can easily be made by first constructing a time vector, and then using this to generate the sine and cosine signals.
The MATLAB^{TM} implementation is evaluated using a 9 kHz cosine signal with zero phase as input. Because the phase of the input signal is zero the
 and
signals should be
The test shows that the I and Qsignals give the desired values, and the algorithm is therefore assumed to be working.
When implementing the algorithm in C the time vector used to generate the digital oscillator is not as easy to make as in MATLAB^{TM}. The reason for this is that when working in MATLAB^{TM} the sound sample has a finite length and therefore also the time vector has a finite length. When working in C the length of the sound sample is dynamical allocated and the time vector can therefore not be generated in the same way. A solution to this problem to divide the sound samples into samples with a known length, and then demodulate the samples one at a time.
Arctan demodulator
The arcus tangent method for FM demodulation is propably the mathematically most straightfarward method, when the
and
signals are present.
The principle is to derive the instantanous phase of the received FM signal by deriving the angle of the complex number
as depicted by equation (N.20). From the definition of FM modulation it is known that the time derivative of the instantanous phase is directly proportional to the message signal, see equation B.16. The principle block diagram is shown in figure N.3.
Figure N.3:
Block diagram of the arcus tangent demodulation method.

The signals at hand are
The proof of this method to derive the message signal,
, is carried out in three steps referring to the blocks of figure N.3. For the calculation of
equation (N.20) is used. For the calculation of
, the time derivative of the phase of an FM signal is used:



(N.37) 



(N.38) 



(N.39) 



(N.40) 



(N.41) 



(N.42) 
In practice a signal received always has a frequency offset, and phase offset, as described in section N.2.1. Carrying out a similar calculation as in the above section with the offset frequency
and offset phase
yields:
Hence a frequency tolerance will introduce a DC offset in the demodulated message signal. Since the phase is differentiated, a constant phase offset will have no influence on the demodulation.
Digitization considerations
All of the above calculations can be carried out on samples instead of continous time signals. The only calculation that may introduce approximation errors is the differentiator, which can not be accurate when operating in discrete time. A discrete time differentiator will use the approximation



(N.46) 
where:
is a continous time signal 

is an integer sample number 

is the sample time 
[s] 
The arcus tangent is implemented using the function atan2() which is a four quadrant arcus tangent. The problem with using its two quadrant counterpart; the regular atan(), is that it only gives output in the range between
and
. As both
and
can take on both positive and negative values, and they are divided with each other in order to use the arcus tangent, the two expressions atan(1/1)() and atan(1/1)() would of course yield the same result even though they are in opposite quadrants. The function atan2() can handle this situation, thus producing the correct output in the full unit circle range between
and
.
The function unwrap() is used to correct jumps in angles that are over
. This is a MATLAB^{TM} function which will not be available in C. Figure N.4 explains the difference between a wrapped and an unwrapped signal, and also presents a different approach to work around a wrapped angle. This approach is only relevant is only relevant for eventually implementation in C.
The differentiator is implemented using the approximate derivative function diff(). The resulting algorithm is so short that it is pasted here:
sigdem = diff(unwrap(atan2(qb, ib)));
Implementation should be straightforward since the function atan2() is present in the standard C math library. A way to work around the wrapped angle output from the function is presented above. The rest should be trivial as well.
Baseband delay demodulator
The Baseband delay demodulator is another straightforward method to obtain the information signal from the
 and
signals.
The principle is the same as that of the arctan demodulation. Namely to derive the instantanous phase of the received FM signal by use of the
 and
signal.
Figure N.5 shows the principle for the Baseband delay demodulator.
Figure N.5:
The principle for the Baseband delay demodulator.

In order to understand precisely how this method generates the information signal from the
 and
signal, a mathematical description of the method is made.
The signals at hand are the
 and
signals discretized



(N.47) 



(N.48) 
From the
 and
signals
and
are found.
By substrating
from
,
is achieved.
It is now possible to find
by taking arcsine to
. If the angle between two samples a sufficient small,
and
is approximately the same. The following shows this approximation.



(N.53) 



(N.54) 



(N.55) 



(N.56) 
and



(N.57) 
From this approximation
is given as
The following shows how the message signal is derived by multiplying
with a constant K.
As described in section N.2 the
 and
signals can change due to a change in the carrier frequency or change in the phase.
Carrying out a similar calculation as in the above section with the offset frequency and phase yields



(N.62) 
This gives
(n)
This means that a change in the carrier frequency results in a DC offset of the message signal, and a change in the phase will have no effect on the message signal.
The method described above can directly be implemented in discrete time. The only calculation that can result in an error is the differentiaton as described in section N.3.3.
In MATLAB^{TM} the method described above can directly be implemented by following the procedure shown in figure N.5.
Implementing the algorithm in C should be no problem.
Baseband differentiator demodulator
The Baseband differentiator demodulator is yet another way to demodulate the FM signal by use of the
 and
signals.
The principle for the Baseband differentiator demodulator is like the preceding methods to obtain the instantaneous phase of the FM signal.
In figure N.6 the principle for the method is shown.
Figure N.6:
The principle for the Baseband differentiator demodulator.

As seen in the figure, the principle can be expressed mathematical as



(N.65) 
In order to see how this method gives the information signal
, a mathematical description is made.
In order to find the two signals
(t) and
(t), the differentiated form of the
 and
signal needs to be known



(N.66) 



(N.67) 



(N.68) 



(N.69) 
It is now possible to find
(t) and
(t)
and
It is now possible to find
(t) by subtracting
(t) from
(t). This gives
knowing that
is equal to



(N.77) 
Equation N.76 can be rewritten as



(N.78) 
Finaly
(t) can be derived by multiplying
(t) with
The calculations made above are for the ideal case. As described in section N.2.1 the
 and
signals can change due to a error in the carrier frequency or a error in the phase of the local oscillator.
Carrying out a similar calculation as in the above section with the offset frequency and phase yields



(N.80) 
This gives
(t)
This means that a change in the carrier frequency results in a DC offset of the message signal, and a change in the phase will have no effect on the message signal.
All of the calculations described above can also be made in discrete time. The only calculation that may introduce an approximation is the differentiation as described in section N.3.3.
The method described above can directly be implementated in MATLAB^{TM} without further considerations.
Like the implementations in MATLAB^{TM} the implementation in C can be made without further considerations.
The three presented algorithms hase some important characteristics in common. They use baseband quadrature signals to determine the phase or the time derivative of the phase of the received FM signal. Filtering is only used in the generation of the quadrature signals where two FIR lowpass filters of order 20 are used. The algorithms themselves only have to look at one sample back in time in order to demodulate.
A frequency offset in the received signal (mistuning) will result in a DCoffset in the message signal derived. A phase offset will have no influence on the demodulation.
The three algorithms have been tested briefly and the sound output is understandable.
Jes Toft Kristensen
20051213