CS434/534: introduction

Wireless PHY:
Modulation and Demodulation
Y. Richard Yang
09/6/2012
Outline
 Admin and recap
 Frequency domain examples
 Basic concepts of modulation
 Amplitude modulation
 Amplitude demodulation
 Digital modulation
2
Admin
 First assignment to be posted by this
weekend
3
Recap: Fourier Series on a General Interval
 A periodic function g(t) on [a, a+T] can be
decomposed as:
g(t) =
¥
å G[k]e
j 2p
k
t
T
k=-¥
1
G[k] =
T
ò
a+T
a
g(t)e
- j 2p
k
t
T
dt
4
Frequency Domain Analysis Examples
Using GNURadio
 spectrum_2sin_plus
Audio
 FFT Sink
 Scope Sink
 Noise

5
Frequency Domain Analysis Examples
Using GNURadio
 spectrum_1sin_rawfft

Raw FFT
6
Frequency Domain Analysis Examples
Using GNURadio
 spectrum_2sin_multiply_complex

Multiplication of a sine first by
• a real sine and then by
• a complex sine
to observe spectrum
7
Takeaway from the Example
 Advantages of I/Q representation
8
Quadrature Mixing
spectrum of complex
signal x(t)
spectrum of complex
signal x(t)ej2f0t
spectrum of complex
signal x(t)e-j2f0t
9
Basic Question: Why Not Send Digital Signal
in Wireless Communications?
 Signals at undesirable frequencies
suppose digital frame length T, then signal
decomposes into frequencies at 1/T, 2/T, 3/T,
…
 let T = 1 ms, generates radio waves at
frequencies of 1 KHz, 2 KHz, 3 KHz, …

1
digital signal
0
t
10
Frequencies are Assigned and Regulated
Cellular
Phones
Cordless
Phones
Wireless
LANs
Others
Europe
USA
Japan
GSM 450 - 457, 479 486/460 - 467,489 496, 890 - 915/935 960,
1710 - 1785/1805 1880
UMTS (FDD) 1920 1980, 2110 - 2190
UMTS (TDD) 1900 1920, 2020 - 2025
CT1+ 885 - 887, 930 932
CT2
864 - 868
DECT
1880 - 1900
IEEE 802.11
2400 - 2483
HIPERLAN 2
5150 - 5350, 5470 5725
RF - Control
27, 128, 418, 433,
868
AMPS , TDMA , CDMA
824 - 849,
869 - 894
TDMA , CDMA , GSM
1850 - 1910,
1930 - 1990
PDC
810 - 826,
940 - 956,
1429 - 1465,
1477 - 1513
PACS 1850 - 1910, 1930 1990
PACS - UB 1910 - 1930
PHS
1895 - 1918
JCT
254 - 380
902 - 928
I EEE 802.11
2400 - 2483
5150 - 5350, 5725 - 5825
IEEE 802.11
2471 - 2497
5150 - 5250
RF - Control
315, 915
RF - Control
426, 868
11
Spectrum and Bandwidth:
Shannon Channel Capacity
 The maximum number of bits that can be
transmitted per second by a physical channel
is:
W log 2 (1  )
S
N
where W is the frequency range of the channel,
and S/N is the signal noise ratio, assuming
Gaussian noise
12
Frequencies for Communications
twisted
pair
coax cable
1 Mm
300 Hz
10 km
30 kHz
VLF
LF
optical transmission
100 m
3 MHz
MF
HF
VLF = Very Low Frequency
LF = Low Frequency
MF = Medium Frequency
HF = High Frequency
VHF = Very High Frequency
1m
300 MHz
VHF
UHF
10 mm
30 GHz
SHF
EHF
100 m
3 THz
infrared
1 m
300 THz
visible light UV
UHF = Ultra High Frequency
SHF = Super High Frequency
EHF = Extra High Frequency
UV = Ultraviolet Light
Frequency and wave length:
 = c/f
wave length , speed of light c  3x108m/s, frequency f
13
Why Not Send Digital Signal in Wireless
Communications?
voice
Transmitter
20-20KHz
At 3 KHz,
Antenna:
size ~ wavelength
8
c
3´10
l= =
=100km
3
f
3´10
Antenna too large!
Use modulation to transfer
to higher frequency
14
Outline
 Recap
 Frequency domain examples
 Basic concepts of modulation
15
Basic Concept of Modulation
Basic
Concept
of
Modulation
BasicConcept
Concept
ofModulation
Modulation
Basic
of
Basic
Concepts
of Modulation
The information source
The
information
source
 The
information
source
The
Theinformation
informationsource
source
Typically
a lowalow
frequency
signal
Typically
frequency
signal
 Typically
Typically
low
frequency
signal
frequency
signal
Typicallyaaalow
low
frequency
signal
Referred
to to
as
the
“baseband
signal”
Referred
to
as
the
“baseband
signal”
 Referred
Referred
as
baseband
signal
as
“baseband
signal”
Referred
toto
asthe
the
“baseband
signal”
x(t)x(t)
x(t)
x(t)
X(f)
X(f)
X(f)
X(f)
t t tt
Carrier
Carrier
Carrier
Carrier
Carrier
f f ff

higherfrequency
frequencysinusoid
sinusoid
AAhigher
baseband
higher
frequency
sinusoid
AAhigher
frequency
sinusoid
baseband
A higher
frequency
sinusoid
baseband
carrier
carrier
Example:
cos(2π10000t)
carrier
 Example:
Example
cos(2π10000t)
Example:cos(2π10000t)
cos(2π10000t)
carrier
Example: cos(2π10000t)
baseband
Modulator
Modulator
Modulator
Modulator
Modulated
Signal
Modulated
ModulatedSignal
Signal
Modulated
Modulated
Modulated
Modulated
signal
signal
signal
signal
Modulated
Signal
Modulated
signal ofofthe
Someparameter
parameter
thecarrier
carrier(amplitude,
(amplitude,frequency,
frequency,phase)
phase)isisvaried
variedinin
Some

Some parameter of the carrier (amplitude, frequency, phase) is varied in
accordance
with
baseband
signal
Some
parameter
ofthe
the
carrier
(amplitude,
frequency,frequency,
phase) is varied
in is
with
baseband
signal
 accordance
Some
parameter
of
the carrier
phase)
accordance
with
the
baseband
signal(amplitude,
varied inwith
accordance
withsignal
the baseband signal
accordance
the baseband
5 55
Flynn/Katz
7/8/10
Flynn/Katz
Flynn/Katz7/8/10
7/8/10
16
Types of Modulation
 Analog modulation
Amplitude modulation (AM)
 Frequency modulation (FM)
 Double and signal sideband: DSB, SSB

 Digital modulation
 Amplitude shift keying (ASK)
 Frequency shift keying: FSK
 Phase shift keying: BPSK, QPSK, MSK
 Quadrature amplitude modulation (QAM)
17
Outline
 Recap
 Frequency domain examples
 Basic concepts of modulation
 Amplitude modulation
18
Amplitude Modulation (AM)
Example: Amplitude Modulation (AM)
Amplitude
Modulation
(AM)
Amplitude
Modulation
(AM) (AM)
Modulation
Block Amplitude
Diagram
Amplitude
Modulation
(AM)
Block
Diagram
 Block
diagram
Block
x(t)
xAM(t)=Ac [1+mx(t)]cos
BlockmDiagram
x
+
x(t)
m x(t) xx
x(t)
m
Block Diagram
+
m +
x
m cosAc tcos
x
ct +
A
Acc cos cct Ac cos
x(t)
 Time
domain
Time
Domain
Time
Domain
Time Domain
Time Domain
Ac cos
Time Domain
xxAM(t)=A
ctct
(t)=Ac c[1+mx(t)]cos
[1+mx(t)]cos
xAM(t)=Ac [1+mx(t)]cos
AM+
ct
-f
-fmm
7
-fm -fm
f
fm
f
fm
-fm
fmfm
f
fm
ct
ct
Frequency Domain
Domain
Frequency
Frequency
Domain
 Frequency
domain
Frequency
Domain
X(f)
X(f)
X(f)
Frequency
Domain
X(f)
X(f)
xAM(t)=Ac [1+mx(t)]cos
f
XAM(f)
XAM(f)
XAM(f)
-fc
-fc
-fc
-fc
-fc Flynn/Katz
Signal
Signalinformation
informatio
S
contained in theSig
contained in the
con
Signal inform
sidebands
c
sidebands
sid
contained in
si
XAM(f)
X (f) sidebands
AM
fc
f
fc
7/8/10
f
f fc
fc
fc 19
Example: am_modulation Example
 Setting
Audio source (sample 32K)
 Signal source (300K, sample 800K)
 Multiply

 Two Scopes
 FFT Sink
20
Example AM Frequency Domain
Note: There is always the negative freq. in the freq. domain.
21
Problem: How to Demodulate AM Signal?
mplitude Modulation (AM)
Block Diagram
mplitude
Modulation
x(t)
m
x
+ (AM) xAM(t)=Ac [1+mx(t)]cos
ct
ock Diagram
x(t)
m
x
Time Domain
me Domain
Ac cos
+
Ac cos
ct
xAM(t)=Ac [1+mx(t)]cos
ct
Signal information is
in the
Signal information contained
is
contained in the sidebands
Xsidebands
AM(f)
Frequency Domain
equency Domain
X(f)
-fm
-fm
X(f)
fm
f
fm
ct
XAM(f)
f
f
-fc
fc
f
22
Outline
 Recap
 Frequency domain examples
 Basic concepts of modulation
 Amplitude modulation
 Amplitude demodulation
23
Design Option 1
 Step 1: Multiply signal by e-jfct

Implication: Need to do complex multiple
multiplication
24
Design Option 1 (After Step 1)
-2fc
25
Design Option 1 (Step 2)
 Apply a Low Pass Filter to remove the
extra frequencies at -2fc
-2fc
26
Design Option 1 (Step 1 Analysis)
 How many complex multiplications do we
need for Step 1 (Multiply by e-jfct)?
27
Design Option 2: Quadrature Sampling
28
Quadrature Sampling: Upper Path (cos)
29
Quadrature Sampling: Upper Path (cos)
30
Quadrature Sampling: Upper Path (cos)
31
Quadrature Sampling: Lower Path (sin)
32
Quadrature Sampling: Lower Path (sin)
33
Quadrature Sampling: Lower Path (sin)
34
Quarature
Sampling:
Putting
Together
35
Exercise: SpyWork
 Setting: a scanner scans 128KHz blocks of AM radio and save
each block to a file (see am_rcv.py).
 SpyWork: Scan the block in a saved file to find radio stations
and tune to each station (each AM station has 10 KHz)
36
Remaining Hole: Designing LPF
 Frequency domain view
-B
B
freq
-B
B
freq
37
Design Option 1
compute freq
-B
freq
zeroing out
not want freq
compute time
signal
-B
Problem of Design Option 1?
B
B
freq
38
Impulse Response Filters
 GNU software radio implements filtering
using
Finite Impulse Response (FIR) filters
 Infinite Impulse Response (IIR) Filters

 FIR filters are more commonly used
 Filtering is common in
networks/communications (and AI and …)
39
FIR Filter
 An N-th order FIR filter h is defined by an
array of N+1 numbers:
h = [h0, h2,..., hN ]
 Assume input sequence x0, x1, …,
yn = xnh0 + xn-1h1 +... + xn-N hN
N
= å xn-i hi
i=0
40
Implementing a 3-rd Order FIR Filter
 An array of size N+1 for h
compute y[n]
xn-3 xn-2 xn-1
xn
*
*
*
*
h3
h2
h1
h0
xn+1
41
Implementing a 3-rd Order FIR Filter
 An array of size N+1 for h
compute y[n+1]
xn-3 xn-2 xn-1
xn
xn+1
*
*
*
*
h3
h2
h1
h0
42
FIR Filter
yn = xnh0 + xn-1h1 +... + xn-N hN
is also called convolution between x (as a
vector) and h (as a vector), denoted as
yn = xn * hn
Key Question: How to Determine h?
43
g*h in the Continuous Time Domain
 Remember that we consider x as samples
of time domain function g(t) on [0, 1] and
(repeat in other intervals)
 We also consider h as samples of time
domain function h(t) on [0, 1] (and repeat in
other intervals)
for (i = 0; i< N; i++)
y[t] += h[i] * g[t-i];
y(t) =
ò
1
0
h(t )g(t - t )d t
44
Visualizing g*h
g(t)
time
h(t)
45
Visualizing g*h
g(t)
t
time
h(t)
46
Fourier Series of y=g*h
Y[k] =
ò
1
0
y(t)e
y(t) =
j 2 p kt
ò
1
0
h(t )g(t - t )d t
dt
1
é
ù
j 2 p kt
= ò ê ò h(t )g(t - t )d t ú e
dt
0ë 0
û
1
1
é
ù
j 2 p kt
= ò ê ò h(t )g(t - t )e
d t ú dt
0ë 0
û
1
47
Fubini’s Theorem
 In English, you can integrate
 first along y and then along x
 first along x and then along y
 at (x, y) grid
They give the same result
See http://en.wikipedia.org/wiki/Fubini's_theorem
48
Fourier Series of y=g*h
Y[k] =
=
=
=
=
y(t) =
ò
1
0
h(t )g(t - t )d t
é 1 h(t )g(t - t )e j 2 p kt d t ù dt
ò 0 êë ò 0
úû
1é 1
ù
j 2 p kt
ò 0 êë ò 0 h(t )g(t - t )e dt úûdt
1
1
é
ù
j 2 p kt
ò 0 h(t )êë ò 0 g(t - t )e dtúûdt
1
ù
j 2 p kt é 1
j 2 p k(t-t )
dt ú d t
ò 0 h(t )e êë ò 0 g(t - t )e
û
1
ò
1
0
h(t )e
j 2 p kt
= G[k]H[k]
G[k]dt
49
Summary of Progress So Far
y = g * h => Y[k] = G[k] H[k]
is called the Convolution Theorem, an
important theorem.
50
Applying Convolution Theorem to Design LPF
 Choose h() so that
H() is close to a rectangle shape
 h() has a low order (why?)

51
Applying Convolution Theorem to Design LPF
 Choose h() so that
H() is close to a rectangle shape
 h() has a low order (why?)

52
Sinc Function
 The h() is often related with the sinc(t)=sin(t)/t
function
sin(p t) - j 2 p ft
ò p t e = rect( f )
-¥
1
¥
-1/2
1/2
f
53
FIR Design in Practice
 Compute h
MATLAB or other design software
 GNU Software radio: optfir (optimal filter
design)
 GNU Software radio: firdes (using a method
called windowing method)

 Implement filter with given h
freq_xlating_fir_filter_ccf or
 fir_filter_ccf

54
LPF Design Example
 Design a LPF to pass signal at 1 KHz and
block at 2 KHz
55
LPF Design Example
#create the channel filter
# coefficients
chan_taps = optfir.low_pass(
1.0, #Filter gain
48000, #Sample Rate
1500, #one sided mod BW (passband edge)
1800, #one sided channel BW (stopband edge)
0.1, #Passband ripple
60) #Stopband Attenuation in dB
print "Channel filter taps:", len(chan_taps)
#creates the channel filter with the coef found
chan = gr.freq_xlating_fir_filter_ccf(
1 , # Decimation rate
chan_taps, #coefficients
0, #Offset frequency - could be used to shift
48e3) #incoming sample rate
56
Outline
 Recap
 Frequency domain examples
 Basic concepts of modulation
 Amplitude modulation
 Amplitude demodulation
 Digital modulation
57
Modulation
 Modulation of digital signals also known as Shift Keying
 Amplitude Shift Keying (ASK):
 vary carrier amp. according to bit value
1
0
1
t
 Frequency Shift Keying (FSK)
o pick carrier freq according to bit value
1
1
t
1
 Phase Shift Keying (PSK):
0
0
1
t
58
Phase Shift Keying: BPSK
 BPSK (Binary Phase Shift Keying):



bit value 0: sine wave
bit value 1: inverted sine wave
very simple PSK
Q
1
0
I
 Properties

robust, used e.g. in satellite systems
59
Phase Shift Keying: QPSK
 QPSK (Quadrature Phase Shift
Q
10
11
Keying):



2 bits coded as one symbol
symbol determines shift of sine wave
often also transmission of relative,
not absolute phase shift: DQPSK Differential QPSK
I
00
01
A
t
11
10
00
0
1
60
Quadrature Amplitude Modulation
 Quadrature Amplitude Modulation (QAM):
combines amplitude and phase modulation
 It is possible to code n bits using one symbol

2n discrete levels
Q
 Example: 16-QAM (4 bits = 1
0010
0001
0011
0000
φ
I
a
1000
symbol)
 Symbols 0011 and 0001 have
the same phase φ, but
different amplitude a. 0000
and 1000 have same
amplitude but different
phase
61
Exercise
 Suppose fc = 1 GHz
(fc1 = 1 GHz, fc0 = 900 GHz
for FSK)
 Bit rate is 1 Mbps
 Encode one bit at a time
 Bit seq: 1 0 0 1 0 1
 Q: How does the wave look
Q
10
11
I
00
01
A
t
11
10
00
0
1
like for?
62
Generic Representation of Digital
Keying (Modulation)
 Sender sends symbols one-by-one
 Each symbol has a corresponding signaling
function g1(t), g2(t), …, gM(t), each has a
duration of symbol time T
 Exercise:
 What is the setting for BPSK? for QPSK?
63
Checking Relationship Among gi()
 BPSK
1: g1(t) = -sin(2πfct) t in [0, T]
 0: g0(t) = sin(2πfct) t in [0, T]

 Are the two signaling functions independent?
 Hint: think of the samples forming a vector, if it
helps, in linear algebra
 Ans: No. g1(t) = -g0(t)
64
Checking Relationship Among gi()
 QPSK
 11: sin(2πfct + π/4) t in [0, T]
 10: sin(2πfct + 3π/4) t in [0, T]
 00: sin(2πfct - 3π/4) t in [0, T]
 01: sin(2πfct - π/4) t in [0, T]
 Are the four signaling functions independent?
 Ans: No. They are all linear combinations of
sin(2πfct) and cos(2πfct).
 We call sin(2πfct) and cos(2πfct) the bases.
 They are orthogonal because the integral of their
product is 0.
65
Discussion: How does the Receiver
Detect Which gi() is Sent?
 Assume synchronized (i.e., the receiver
knows the symbol boundary).

This is also called coherent detection
66
Example: Matched Filter Detection
 Basic idea




consider each gm[0,T] as a point (with
coordinates) in a space
compute the coordinate of the received signal
s[0,T]
check the distance between gm[0,T] and the
received signal s[0,T]
pick m* that gives the lowest distance value
67
Computing Coordinates
 Pick orthogonal bases {f1(t), f2(t), …, fN(t)}
for {g1(t), g2(t), …, gM(t)}
 Compute the coordinate of gm[0,T] as
cm = [cm1, cm2, …, cmN], where
cmi =
T
òg
m
(t) fi (t)dt
0
 Compute the coordinate of the received
signal r[0,T] as r = [r1, r2, …, rN]
 Compute the distance between r and cm
every cm and pick m* that gives the lowest
distance value
68
Example: Matched Filter => Correlation
Detector
received
signal
69
Spectral Density of BPSK
Spectral Density =
bit rate
------------------width of spectrum used
b
b
fc : freq. of carrier
Rb =Bb = 1/Tb
fc
70
Phase Shift Keying: Comparison
fc: carrier freq.
Rb: freq. of data
10dB = 10; 20dB =100
BPSK
A
QPSK
t
11
10
00
01
71
Question
 Why would any one use BPSK, given higher QAM?
72