CS434/534: Topics in Networked (Networking) Systems Wireless Foundation: LPF; Digital Modulation and Demodulation; Wireless Channel Yang (Richard) Yang Computer Science Department Yale University 208A Watson Email: yry@cs.yale.edu http://zoo.cs.yale.edu/classes/cs434/
Admin PS1 status
Recap: Amplitude Modulation (AM) Block diagram Time domain Frequency domain
Recap: Demod of AM Design option 1: multiply modulated signal by e-jfct, and then LPF Design option 2: quadrature sampling
Remaining Hole: How to Design LPF Frequency domain view freq B -B freq B -B
Recap: Design Option 1 compute freq zeroing out outband freq compute lower-pass time signal freq B -B This is essentially how image compression works. Problem(s) of Design Option 1: FFT + IFFT
Design Option 2: 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 FIR/IIR is essentially online, streaming algorithms They are used in networks/communications/vision/robotics…
FIR Filter An N-th order FIR filter h is defined by an array of N+1 numbers: They are often stored backward (flipped) Assume input data stream is x0, x1, …, … hN h2 h1 h0
xn-3 xn-2 xn-1 xn xn+1 * * * * h3 h2 h1 h0 FIR Filter compute y[n]: 3rd-Order Filter h3 h2 h1 h0 compute y[n]:
FIR Filter xn-3 xn-2 xn-1 xn xn+1 * * * * h3 h2 h1 h0 compute y[n+1]
FIR Filter is also called convolution between x (as a vector) and h (as a vector), denoted as
Key Question Using h to Implement LPF How to determine h? Approach: Understand the effects of y=g*h in the frequency domain
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]; Ignore the 1/N part
Visualizing g*h g(t) time h(t) T T
Visualizing g*h g(t) g(t) time t h(0) T T
Fourier Series of y=g*h
In English, you can integrate 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
Fourier Series of y=g*h
Summary of Progress So Far y = g * h => Y[k] = G[k] H[k] In the case of Fourier Transform, y = g * h => Y[f] = G[f] H[f] is called the Convolution Theorem, an important theorem.
Applying Convolution Theorem to Design LPF Choose h() so that H() is close to a rectangle shape h() has a low order (why?) f 1/2 -1/2 1
Sinc Function The h() is often related with the sinc(t)=sin(t)/t function f 1/2 -1/2 1
FIR Design in Practice (Offline) 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
LPF Design Example (Offline) Design a LPF to pass signal at 1 KHz and block at 2 KHz
LPF Design Example (Offline) #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
Outline Recap Wireless background Frequency domain Modulation and demodulation Basic concepts Amplitude modulation/demodulation Amplitude demodulation frequency shifting low pass filter and Convolution Theorem Digital modulation
Modulation Modulation of digital signals also known as Shift Keying Amplitude Shift Keying (ASK): vary carrier amp. according to data Frequency Shift Keying (FSK) vary carrier freq. according to bit value Phase Shift Keying (PSK) vary carrier freq. according to data 1 1 t 1 1 t 1 1 t
Phase Shift Keying: BPSK BPSK (Binary Phase Shift Keying): bit value 1: cosine wave cos(2πfct) bit value 0: inverted cosine wave cos(2πfct+π) very simple PSK Properties robust, used e.g. in satellite systems Q I 1 one bit time T one bit time T 1
Phase Shift Keying: QPSK 11 01 10 00 QPSK (Quadrature Phase Shift Keying): 2 bits coded at a time we call the two bits as one symbol symbol determines shift of cosine wave often also transmission of relative, not absolute phase shift: DQPSK - Differential QPSK
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 0000 0001 0011 1000 Q I 0010 φ a Example: 16-QAM (4 bits = 1 symbol) Symbols 0011 and 0001 have the same phase φ, but different amplitude a. 0000 and 1000 have same amplitude but different phase
Generic Representation of Digital Keying (Modulation) Sender sends symbols one-by-one M signaling functions g1(t), g2(t), …, gM(t), each has a duration of symbol time T Each value of a symbol has a signaling function
Exercise: gi() for BPSK 1: g1(t) = cos(2πfct) t in [0, T] 0: g0(t) = -cos(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) Q I 1 cos(2πfct)[0, T] 1 -1 g0(t) g1(t)
Exercise: Signaling Functions gi() for QPSK 11: cos(2πfct + π/4) t in [0, T] 10: cos(2πfct + 3π/4) t in [0, T] 00: cos(2πfct - 3π/4) t in [0, T] 01: cos(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). Q I 11 01 10 00 They are orthogonal because the integral of their product is 0.
QPSK Signaling Functions as Sum of cos(2πfct), sin(2πfct) 11 00 10 11: cos(π/4 + 2πfct) t in [0, T] -> cos(π/4) cos(2πfct) + -sin(π/4) sin(2πfct) 10: cos(3π/4 + 2πfct) t in [0, T] -> cos(3π/4) cos(2πfct) + -sin(3π/4) sin(2πfct) 00: cos(- 3π/4 + 2πfct) t in [0, T] sin(3π/4) sin(2πfct) 01: cos(- π/4 + 2πfct) t in [0, T] sin(π/4) sin(2πfct) 01 [cos(3π/4), sin(3π/4)] [cos(π/4), sin(π/4)] cos(2πfct) [cos(3π/4), -sin(3π/4)] [-sin(π/4), cos(π/4)] We call sin(2πfct) and cos(2πfct) the bases.
Outline Recap Wireless background Frequency domain Modulation and demodulation Basic concepts Amplitude modulation/demodulation Digital modulation modulation demodulation
Key Question: How does the Receiver Detect Which gi() is Sent? Assume synchronized (i.e., the receiver knows the symbol boundary).
Starting Point Considered a simple setting: sender uses a single signaling function g(), and can have two actions send g() or nothing (send 0) How does receiver use the received sequence x(t) in [0, T] to detect if sends g() or nothing?
Design Option 1 Sample at a few time points (features) to check Issue Not use all data points, and less robust to noise
Design Option 2 xT x2 x1 x0 h0 h1 h2 hT * Streaming algorithm, using all data points in [0, T] As each sample xi comes in, multiply it by a factor hT-i and accumulate to a sum y At time T, makes a decision based on the accumulated sum at time T: y[T] xT x2 x1 x0 h0 h1 h2 hT *
Example Streaming (Convolution/Correlation): Assume incoming x is a rectangular pulse (in baseband) and h is also a rectangular pulse A gif animation (play in ppt) presentation): redline g(): the sliding filter h(t) blue line f(): the input x() Source: http://en.wikipedia.org/wiki/File:Convolution_of_box_signal_with_itself2.gif
Determining the Best h where w is noise, Design objective: maximize peak pulse signal-to-noise ratio
Determining the Best h Assume Gaussian noise, one can derive Using Fourier Transform and Convolution Theorem:
Determining the Best h Apply Schwartz inequality By considering
Determining the Best h
Determining Best h to Use xT x2 x1 x0 h0 h1 h2 hT * xT x2 x1 x0 gT g2 g1 g0 *
Matched Filter Decision is called Matched filter. Example decision time
Summary of Progress After this “complex” math, the implementation/interpretation is actually the following quite simple alg: precompute auto correlation: <g, g> compute the correlation between received x and signaling function g, denoted as <x, g> if <x, g> is closer to <g, g> output sends g else output sends nothing
Applying Scheme to BPSK Consider g1 alone, compute <x, g1>, check if close to <g1, g1>: |<x, g1> - <g1, g1>| Consider g0 alone, compute <x, g0>, check if close to <g0, g0>: |<x, g0> - <g0, g0>| Pick closer if |<x, g1> - <g1, g1>| < |<x, g0> - <g0, g0>| pick 1 else pick 0 cos(2πfct)[0, T] 1 -1 g1(t) g0(t)
Applying Scheme to BPSK since g0 = -g1 <x, g0> = - <x, g1> <g0, g0> = - <g0, g1> rewrite as if |<x, g1> - <g1, g1>| < |<x, g1> - <g0, g1>| pick 1 else pick 0 cos(2πfct)[0, T] 1 -1 g1(t) g0(t)
Interpretation For any signal s, <s, g1> computes the coordinate (projection) of s when using g1 as a base cleaner if g1 is normalized (i.e., scale g1 by sqrt of <g1, g1>), but we do not worry about it yet <x, g1(t)> g1=cos(2πfct)[0, T] <g0(t), g1(t)> <g1(t), g1(t)> =-<g1(t), g1(t)>
Applying Scheme to QPSK: Attempt 1 Consider g00 alone, compute <x, g00> … Consider g01 alone, compute <x, g01> … Consider g10 alone, compute <x, g10> … Consider g11 alone, compute <x, g11> … Issues Complexity: need to compute M correlation, where M is number of signaling functions Think of 64-QAM
Decoding for QPSK using bases 4 signaling functions g00(), g01(), g10(), g11() For each signaling function, computes correlation with the bases (cos(), sin()), e.g., g00: [a00, b00] For received signal x, computes ax=<x, cos> and bx=<x, sin> Question: what is the meaning of a00, b00
QPSK Demodulation/Decoding sin(2πfct) [a00,b00] [a01,b01] [ax,bx] cos(2πfct) [a10,b10] [a11,b11] Q: how to decode?
Look into Noise Assume sender sends gm(t) [0, T] Receiver receives x(t) [0, T] Consider one sample where w[i] is noise Assume white noise, i.e., prob w[i] = z is
Likelihood What is the likelihood (prob.) of observing x[i]? it is the prob. of noise being w[i] = x[i] – g[i] What is the likelihood (prob.) of observing the whole sequence x? the product of the probabilities
Likelihood Detection Suppose we know Maximum likelihood detection picks the m with the highest P{x|gm}. From the expression We pick m with the lowest ||x-gm||2
Back to QPSK Yry: Ignored noise effect: Suppose sender sends m: x(t) = g_m(t) + w(t) a_x = <g_m(t) + w(t), cos()> = a_m + <w, cos> = a_m + a_w b_x = <g_m(t) + w(t), sin()> = b_m + <w, sin> = b_m + b_w x(t) = g_m(t) + w(t) = (a_x – a_w) cos() + (b_x – b_w) sin() + n(t) = a_x cos() + b_x sin() + n’(t), where n’(t) = n(t) – a_w cos() – b_w sin() [a_x cos() + b_x sin() + n’(t) – g_i(t)]^2 = = [a_x cos() + b_x sin() – g_i(t)]^2 + n’()^2 + 2 n’()* [a_x cos() + b_x sin() – g_i(t)] Consider E[n’(t) a_x] = E[n’(t)(a_m+a_w)] = E[n’(t)a_w] =
QPSK Demodulation/Decoding sin(2πfct) [a00,b00] [a01,b01] [ax,bx] cos(2πfct) [a10,b10] [a11,b11] Q: what does maximum likelihood det pick?
General Matched Filter Detection: Implementation for Multiple Sig Func. Basic idea consider each gm[0,T] as a point (with coordinates) in a space compute the coordinate of the received signal x[0,T] check the distance between gm[0,T] and the received signal x[0,T] pick m* that gives the lowest distance value
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 Compute the coordinate of the received signal x[0,T] as x = [x1, x2, …, xN] Compute the distance between r and cm every cm and pick m* that gives the lowest distance value
Example: Matched Filter => Correlation Detector received signal x
BPSK vs QPSK fc: carrier freq. Rb: freq. of data 10dB = 10; 20dB =100 11 10 00 01
Context Previous demodulation considers only additive noise, and does not consider wireless channel’s effects Wireless channels more than add some noise to a signaling function g(t) We next study its effects
Outline Recap Wireless background Frequency domain Modulation and demodulation Basic concepts Amplitude modulation/demodulation Digital modulation of additive noise channel modulation demodulation Wireless channels
Signal Propagation
Antennas: Isotropic Radiator Isotropic radiator: a single point equal radiation in all directions (three dimensional) only a theoretical reference antenna Radiation pattern: measurement of radiation around an antenna z y z ideal isotropic radiator y x x Q: how does power level decrease as a function of d, the distance from the transmitter to the receiver?
Free-Space Isotropic Signal Propagation In free space, receiving power proportional to 1/d² (d = distance between transmitter and receiver) Suppose transmitted signal is cos(2ft), the received signal is Pr: received power Pt: transmitted power Gr, Gt: receiver and transmitter antenna gain (=c/f): wave length Sometime we write path loss in log scale: Lp = 10 log(Pt) – 10log(Pr)
Log Scale for Large Span dB = 10 log(times) Log Scale for Large Span ~100B 10,000 times 10,000 x 1,000 40 dB 40 + 30 = 70 dB ~10M 1000 times 30 dB ~10K Slim/Gates Obama
Path Loss in dB dB = 10 log(times) 40 dB 40 + 30 = 70 dB 30 dB 10 W 10,000 x 1,000 40 dB 40 + 30 = 70 dB power 1 mW 1000 times 30 dB 1 uW source d1 d2
dBm (Absolute Measure of Power) dBm = 10 log (P/1mW) dBm (Absolute Measure of Power) 10 W 40 dBm 10,000 times 10,000 x 1,000 40 dB 40 + 30 = 70 dB power 1 mW 1000 times 30 dB 1 uW -30 dBm source d1 d2
Number in Perspective (Typical #) Data rate (Mbps) Receive threshold (dBm) Signal/Noise (dB) 6 -82 6.02 9 -81 7.78 12 -79 9.03 18 -77 10.79 24 -74 17.04 36 -70 18.8 48 -66 24.05 54 -65 24.56
Figure for Thought: Real Measurements
Signal Propagation: Complexity Receiving power additionally influenced by shadowing (e.g., through a wall or a door) refraction depending on the density of a medium reflection at large obstacles scattering at small obstacles diffraction at edges diffraction reflection refraction scattering shadow fading
Signal Propagation: Complexity Details of signal propagation are very complicated We want to understand the key characteristics that are important to our understanding
Outline Recap Wireless background Frequency domain Modulation and demodulation Basic concepts Amplitude modulation/demodulation Digital modulation of additive noise channel Wireless channels intro shadowing
Shadowing Signal strength loss after passing through obstacles Same distance, but different levels of shadowing: It is a random, large-scale effect depending on the environment
Example Shadowing Effects i.e. reduces to ¼ of signal 10 log(1/4) = -6.02
Example Shadowing Effects i.e. reduces to ¼ of signal 10 log(1/4) = -6.02
Outline Recap Wireless background Frequency domain Modulation and demodulation Basic concepts Amplitude modulation/demodulation Digital modulation of additive noise channel Wireless channels intro shadowing multipath
Multipath Signal can take many different paths between sender and receiver due to reflection, scattering, diffraction
Comparison Shadowing Multipath Same distance, but different levels of shadowing by large objects It is a random, large-scale effect depending on the environment Multipath Signal of same symbol taking multiple paths may interfere constructively and destructively at the receiver also called small-scale fading
Multipath Example: Outdoor Example: reflection from the ground or building ground
Multipath Effect (A Simple Example) Assume transmitter sends out signal cos(2 fc t) d1 d2 phase difference:
Multipath Effect (A Simple Example) Suppose at d1-d2 the two waves totally destruct, i.e., if receiver moves to the right by /4: d1’ = d1 + /4; d2’ = d2 - /4; Discussion: how far is /4? What are implications?
Multipath Effect (A Simple Example): Change Frequency Suppose at f the two waves totally destruct, i.e. Smallest change to f for total construct: (d1-d2)/c is called delay spread.
Multipath Delay Spread RMS: root-mean-square
Multipath Effect (moving receiver) example d d1 d2 Suppose d1=r0+vt d2=2d-r0-vt d1d2
Derivation See http://www.sosmath.com/trig/Trig5/trig5/trig5.html for cos(u)-cos(v)
Derivation See http://www.sosmath.com/trig/Trig5/trig5/trig5.html for cos(u)-cos(v)
Derivation See http://www.sosmath.com/trig/Trig5/trig5/trig5.html for cos(u)-cos(v)
Derivation See http://www.sosmath.com/trig/Trig5/trig5/trig5.html for cos(u)-cos(v)
Derivation See http://www.sosmath.com/trig/Trig5/trig5/trig5.html for cos(u)-cos(v)
Derivation See http://www.sosmath.com/trig/Trig5/trig5/trig5.html for cos(u)-cos(v)
Waveform v = 65 miles/h, fc = 1 GHz: fc v/c = 109 * 30 / 3x108 = 100 Hz 10 ms deep fade Q: how far does the car move between two deep fade?