MIT EECS: 6.003 Signal Processing lecture notes (Spring 2019)

22
6.003: Signal Processing Communications Systems May 7, 2019

Transcript of MIT EECS: 6.003 Signal Processing lecture notes (Spring 2019)

Page 1: MIT EECS: 6.003 Signal Processing lecture notes (Spring 2019)

6.003: Signal Processing

Communications Systems

May 7, 2019

Page 2: MIT EECS: 6.003 Signal Processing lecture notes (Spring 2019)

Matching Signals to Communications Media

A key problem in the design of any communications system is match-

ing characteristics of the signal to those of the media.

For example, to efficiently transduce radio waves, the size of an

antenna must be on the order of a wavelength λ (often λ/4).

λ

f = c/λ

1010.10.01

1010

109

108he

rtz

meters

Small antennae (as in cell phones) are most efficient at high fre-

quencies (>GHz). Not well matched to audio signals!

Page 3: MIT EECS: 6.003 Signal Processing lecture notes (Spring 2019)

Matching Signals to Communications Media

A sampling of communications systems:

• cellular communications

• wifi

• broadband

• cable

• bluetooth

• GPS (the Global Positioning System)

• private networks: fire departments, police

• radar and navigation systems

• IOT (the Internet of Things)

− smart house / smart appliances

− smart car

− medical devices

• many more

Page 4: MIT EECS: 6.003 Signal Processing lecture notes (Spring 2019)

Amplitude Modulation

Amplitude modulation is a common technique for modifying the

frequencies used to represent a signal.

In this scheme, the signal x(t) is multiplied by a high-frequency

carrier signal.

×x(t) y(t)

cos(ωct)

tx(t) cos(ωct)

tx(t)

tcos(ωct)

Describe the effect of this multiplication in the frequency domain.

How can x(t) be recovered from y(t)?

Page 5: MIT EECS: 6.003 Signal Processing lecture notes (Spring 2019)

Amplitude Modulation

Frequency representation of AM signals.

y(t) = x(t) cos(ωct) = 12x(t)

(ejωct + e−jωct

)Y (ω) =

∫ ∞−∞

y(t)e−jωt dt =∫ ∞−∞

12x(t)

(ejωct + e−jωct

)e−jωt dt

= 12X(ω−ωc) + 1

2X(ω+ωc)

2ωm

ω

X(ω)

2ωm2ωmω

Y (ω)

−ωc ωc

Page 6: MIT EECS: 6.003 Signal Processing lecture notes (Spring 2019)

Frequency Shift Property

If

x(t) ctft←→X(ω)

then

ejωctx(t) ctft←→X(ω − ωc)

Page 7: MIT EECS: 6.003 Signal Processing lecture notes (Spring 2019)

Synchronous Demodulation

Recovering a signal after amplitude modulation.

× × LPFx(t)y(t) z(t)

x̂(t)

cos(ωct) 2 cos(ωct)

Multiply the received signal y(t) by the carrier and then lowpass filter.

This process is called synchronous demodulation.

y(t) = x(t) cos(ωct)

z(t) = y(t) × 2 cos(ωct) = 2x(t) × cos(ωct) × cos(ωct) = x(t) (1 + cos(2ωct))

Describe the synchronous demodulation process in frequency.

Page 8: MIT EECS: 6.003 Signal Processing lecture notes (Spring 2019)

Synchronous Demodulation

Frequency representation of synchronous demodulation.

2ωm

ω

X(ω)

2ωm2ωmω

Y (ω)

−ωc ωc

2ωm2ωm2ωm

ω

Z(ω)

−2ωc 2ωc

Page 9: MIT EECS: 6.003 Signal Processing lecture notes (Spring 2019)

Synchronous Demodulation

A problem with synchronous demodulation is that the carrier signal

must be known exactly! Even a time delay (phase shift) is problem-

atic. What happens if there is a phase shift φ between the signal

used to modulate and that used to demodulate?

× × LPFx(t)y(t) z(t)

x̂(t)

cos(ωct) 2 cos(ωct+φ)

z(t) = 2x(t) × cos(ωct) × cos(ωct+φ)= x(t) × (cos(φ) + cos(2ωct+φ))

Passing z(t) through a low pass filter yields x(t) cos(φ).

If φ = π/2, the output is zero!

If φ changes with time, then the signal “fades.”

Page 10: MIT EECS: 6.003 Signal Processing lecture notes (Spring 2019)

AM with Carrier

A more robust method is to send the carrier along with the message.

× +

C

x(t) z(t)

cos(ωct)

z(t) = x(t) cos(ωct) + C cos(ωct) = (x(t) + C) cos(ωct)

t

z(t)

x(t) + C

Adding carrier is equivalent to shifting the DC value of x(t).If we shift the DC value sufficiently, the message is easy to decode:

it is just the envelope (minus the DC shift).

How would you reconstruct x(t) from z(t)?

Page 11: MIT EECS: 6.003 Signal Processing lecture notes (Spring 2019)

AM with Carrier

AM with carrier requires more power to transmit the carrier than to

transmit the message!x(t)

xp

xrms

xp > 35xrms

t

Speech sounds have high crest factors (peak value divided by rms

value). The DC offset C must be larger than xp for simple envelope

detection to work.

The power needed to transmit the carrier can be 352 ≈ 1000× that

needed to transmit the message.

Okay for broadcast radio (WBZ: 50 kwatts).

Not for point-to-point (cell phone batteries wouldn’t last long!).

Page 12: MIT EECS: 6.003 Signal Processing lecture notes (Spring 2019)

Amplitude Demodulation

In principle, the carrier signal can be inferred from an AM signal.

tx(t) cos(ωct)

tx(t)

tcos(ωct)

However, the required processing (e.g., using phase locked loops)

is not simple, and requires assumptions about the signal (e.g., that

x(t) is rarely 0).

Page 13: MIT EECS: 6.003 Signal Processing lecture notes (Spring 2019)

AM Radio

Commercial AM radio

• 106 channels

• each channel is allocated 10 kHz bandwidth

• center frequencies from 540 kHz to 1600 kHz

Continuousto Discrete

SoftwareRadio

Discrete toContinuous

x(t) x[n] y[n] y(t)

fc

Design the Software Radio:

• Assume that x(t) is sampled at 10 M samples/second.

• Decode the channel centered on fc [Hz].

• Save results to .wav file, sample frequency 44,100 samples/second.

Page 14: MIT EECS: 6.003 Signal Processing lecture notes (Spring 2019)

AM Radio

Simulation:

• 10 seconds of data

• 24 channels

• sampled at 10 Msamples/second.

Plot of DFT magnitude and zoomed version.

Page 15: MIT EECS: 6.003 Signal Processing lecture notes (Spring 2019)

Software Radio

Process in 10 second blocks.

× LPFx(t)y(t)

x̂(t)

2 cos(ωct)

Implementation.

• fetch x[0:N] where N = 108

• y = [x[n]*2*cos(2*pi*fc/fs*n) for n in range(N)]• Y = fft(y)• set Y[k] = 0 for k outside LPF passband

• z = ifft(Y)-1• downsample to 44, 100 samples/second

Q: Do you really need to multiply by cos(ωct)?

A: No. Just shift the k’s near ωc down to k = 0.

Page 16: MIT EECS: 6.003 Signal Processing lecture notes (Spring 2019)

Software Radio

Final code.

def receive(x,fs,fc,filename):N = len(x)X = fft(x)Y = numpy.zeros(N,dtype=complex)for k in range(-5000*N//fs,5000*N//fs+1):

Y[k] = X[k+fc*N//fs]y = 2*numpy.real(ifft(Y))-1z = [y[n*fs//44100] for n in range(N*44100//fs)]wav_write(z,44100,filename)

receive(x,10000000,570000,’z570.wav’)receive(x,10000000,660000,’z660.wav’)receive(x,10000000,700000,’z700.wav’)receive(x,10000000,780000,’z780.wav’)

Page 17: MIT EECS: 6.003 Signal Processing lecture notes (Spring 2019)

Strategy 1

Works fine.

Listen to examples: z660.wav, z570.wav, z700.wav, z780.wav

One problem: none of output is ready until all of output is processed.

Not good for streaming.

Page 18: MIT EECS: 6.003 Signal Processing lecture notes (Spring 2019)

Strategy 2

Process the input stream in 0.01 second chunks.

def receive(x,fs,fc,filename):N = len(x)NN = N//1000zz = []for c in range(N//NN):

xx = x[c*NN:c*NN+NN]XX = fft(xx)YY = numpy.zeros(NN,dtype=complex)for k in range(-5000*NN//fs,5000*NN//fs+1):

YY[k] = XX[k+fc*NN//fs]yy = 2*numpy.real(ifft(YY))-1zz.extend(list(yy))

ww = [zz[n*fs//44100] for n in range(len(zz)*44100//fs)]wav_write(ww,44100,filename)

receive(x,10000000,780000,’zz780.wav’)

Listen to result: zz780.wav. What causes the distortions?

Page 19: MIT EECS: 6.003 Signal Processing lecture notes (Spring 2019)

Strategy 2

The problem is with the “ideal” lowpass filtering.

N = 100000

H[k] ={

1 if −5 ≤ k ≤ 50 otherwise

k

H[k]

−5 5

n

h[n]

−N/11 N/11

When lowpass filtering with a DFT, the convolution is circular.

The resulting signal wraps from end to end.

Page 20: MIT EECS: 6.003 Signal Processing lecture notes (Spring 2019)

Overlap-Add Method

Can fix this problem using overlap add.

x[n]

n

N

N

N

Window 0

Window 1

Window 2s

s

Fill each window with s samples of the input and N−s zeros.

Then convolve each window with a filter of length N−s and sum the

windows.

Page 21: MIT EECS: 6.003 Signal Processing lecture notes (Spring 2019)

Strategy 3

Use overlap add.

def filter(x,fs,fc):N = 100000s = N*3//4

H = numpy.zeros(N,dtype=complex)for k in range(-5000*N//fs,5000*N//fs+1):

H[k] = 1h1 = list(ifft(H))h2 = h1[N-N//8+1:]+h1[:N//8+1]+(3*N//4)*[0]

# Hann windowfor n in range(N//4):

h2[n] *= (1-cos(2*pi*n/(N//4)))/2return fft(h2)

The resulting filter h[n] has length N but only N−s non-zero values.

Page 22: MIT EECS: 6.003 Signal Processing lecture notes (Spring 2019)

Strategy 3 (continued)

def receive(x,fs,H,fc,filename):N = 100000s = N*3//4out = []keep = (N-s)*[0]for i in range(len(x)//s):

X = fft(list(x[i*s:i*s+s])+(N-s)*[0])Y = numpy.zeros(N,dtype=complex)for k in range(-5000*N//fs,5000*N//fs+1):

Y[k] = X[k+fc*N//fs]Z = [y*h for y,h in zip(Y,H)]z = numpy.real(ifft(Z))out.extend([k+z for k,z in zip(keep,z[0:len(keep)])])out.extend(z[len(keep):s])keep = z[s:]

w = [2*out[n*fs//44100]-1 for n in range(N//4,len(out)*44100//fs)]wav_write(w,44100,filename)

H = filter(x,10000000,780000)receive(x,10000000,H,780000,’zzz780.wav’)

Listen to result: zzz780.wav.