23
Sampling and Pulse Trains Sampling and interpolation Practical interpolation Pulse trains Analog multiplexing

SamplingandPulseTrains - Stanford University · 2017. 10. 30. · ej2πnfst (f s = 1 Ts) Thus g = g(t)III(t/Ts) = 1 Ts X∞ n=−∞ g(nTs)ej2πnfst and by the frequency shifting

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: SamplingandPulseTrains - Stanford University · 2017. 10. 30. · ej2πnfst (f s = 1 Ts) Thus g = g(t)III(t/Ts) = 1 Ts X∞ n=−∞ g(nTs)ej2πnfst and by the frequency shifting

Sampling and Pulse Trains

◮ Sampling and interpolation

◮ Practical interpolation

◮ Pulse trains

◮ Analog multiplexing

Page 2: SamplingandPulseTrains - Stanford University · 2017. 10. 30. · ej2πnfst (f s = 1 Ts) Thus g = g(t)III(t/Ts) = 1 Ts X∞ n=−∞ g(nTs)ej2πnfst and by the frequency shifting

Sampling Theorem

Sampling theorem: a signal g(t) with bandwidth B can be reconstructedexactly from samples taken at any rate R > 2B.

Sampling can be achieved mathematically by multiplying by an impulsetrain. The unit impulse train is defined by

III(t) =

∞∑

n=−∞

δ(t− k)

The unit impulse train is also called the III or comb function.

Sampling a signal g(t) uniformly at intervals Ts yields

g(t) = g(t) IIITs(t) =

∞∑

n=−∞

g(t)δ(t − nTs) =

∞∑

n=−∞

g(nTs)δ(t − nTs)

Only information about g(t) at the sample points is retained.

Page 3: SamplingandPulseTrains - Stanford University · 2017. 10. 30. · ej2πnfst (f s = 1 Ts) Thus g = g(t)III(t/Ts) = 1 Ts X∞ n=−∞ g(nTs)ej2πnfst and by the frequency shifting

Fourier Transform of III(t)

Fact: the Fourier transform of III(t) is III(f).

F III(t) =

∞∑

n=−∞

Fδ(t − n) =

∞∑

n=−∞

e−j2πnf =

∞∑

n=−∞

ej2πnf = III(f)

The complex exponentials cancel at noninteger frequencies and add up toan impulse at integer frequencies.

−5 −4 −3 −2 −1 0 1 2 3 4 5−5

0

5

10

15

20

25N = 10

−5 −4 −3 −2 −1 0 1 2 3 4 50

50

100

150

200

250N = 100

Page 4: SamplingandPulseTrains - Stanford University · 2017. 10. 30. · ej2πnfst (f s = 1 Ts) Thus g = g(t)III(t/Ts) = 1 Ts X∞ n=−∞ g(nTs)ej2πnfst and by the frequency shifting

Fourier Transform of Sampled Signal

The impulse train III(t/Ts) is periodic with period Ts.

III(t/Ts) can be represented as sum of complex exponentials of multiples ofthe fundamental frequency:

III(t/Ts) =1

Ts

∞∑

n=−∞

ej2πnfst (fs =1

Ts)

Thus

g = g(t) III(t/Ts) =1

Ts

∞∑

n=−∞

g(nTs)ej2πnfst

and by the frequency shifting property

G(f) =1

Ts

∞∑

n=−∞

G(f − nfs)

This sum of shifts of the spectrum can be written as III(f/fs) ∗G(f).

Page 5: SamplingandPulseTrains - Stanford University · 2017. 10. 30. · ej2πnfst (f s = 1 Ts) Thus g = g(t)III(t/Ts) = 1 Ts X∞ n=−∞ g(nTs)ej2πnfst and by the frequency shifting

Sampled Signal and Fourier Transform

Page 6: SamplingandPulseTrains - Stanford University · 2017. 10. 30. · ej2πnfst (f s = 1 Ts) Thus g = g(t)III(t/Ts) = 1 Ts X∞ n=−∞ g(nTs)ej2πnfst and by the frequency shifting

Reconstruction from Uniform Samples (Ideal)

If sample rate 1/Ts is greater than 2B, shifted copies of spectrum do notoverlap, so low pass filtering recovers original signal.

Cutoff frequency of low pass filter should satisfy

B ≤ fc ≤ fs −B

Suppose fc = B. A low pass filter with gain Ts has transfer function andimpulse response

H(f) = TsΠ( f

2B

)

, h(t) = 2BTs sinc(2πBt)

Then if Ts = 1/2B

h(t) ∗ g(t) =∞∑

n=−∞

h(t) ∗ g(nTs)δ(t − nTs)

=∞∑

n=−∞

g(nTs) sinc(2πB(t− nTs))

Page 7: SamplingandPulseTrains - Stanford University · 2017. 10. 30. · ej2πnfst (f s = 1 Ts) Thus g = g(t)III(t/Ts) = 1 Ts X∞ n=−∞ g(nTs)ej2πnfst and by the frequency shifting

Ideal Interpolation

Ideal interpolation represents a signal as sum of shifted sincs.

Page 8: SamplingandPulseTrains - Stanford University · 2017. 10. 30. · ej2πnfst (f s = 1 Ts) Thus g = g(t)III(t/Ts) = 1 Ts X∞ n=−∞ g(nTs)ej2πnfst and by the frequency shifting

Practical Interpolation

In practice we require a causal filter. We can delay the impulse responseand eliminate values at negative times.

h̃(t) =

{

h(t− t0) t > 0

0 t < 0

−2 −1 0 1 2 3 4 5 6 7 8

0

0.5

1

−5 −4 −3 −2 −1 0 1 2 3 4 50

0.5

1

1.5

Page 9: SamplingandPulseTrains - Stanford University · 2017. 10. 30. · ej2πnfst (f s = 1 Ts) Thus g = g(t)III(t/Ts) = 1 Ts X∞ n=−∞ g(nTs)ej2πnfst and by the frequency shifting

Practical Interpolation (cont.)

In practice, the sampled signal is a sum of pulses, not impulses.

g̃(t) =

∞∑

n=−∞

g(nTs)p(t− nTs)

= p(t) ∗

∞∑

n=−∞

g(nTs)δ(t − nTs) = p(t) ∗ g(t)

Page 10: SamplingandPulseTrains - Stanford University · 2017. 10. 30. · ej2πnfst (f s = 1 Ts) Thus g = g(t)III(t/Ts) = 1 Ts X∞ n=−∞ g(nTs)ej2πnfst and by the frequency shifting

Practical Interpolation (cont.)

By the convolution theorem,

G̃(f) = P (f) ·1

Ts

∞∑

n=−∞

G(f − nfs)

We can recover G(f) from G̃(f) by low pass filtering to eliminate highfrequency shifts and equalizing by inverting P (f).

E(f) =

{

Ts/P (f) |f | < B

0 |f | > B

The transfer function E(f) should not be close to 0 in the pass band.

Page 11: SamplingandPulseTrains - Stanford University · 2017. 10. 30. · ej2πnfst (f s = 1 Ts) Thus g = g(t)III(t/Ts) = 1 Ts X∞ n=−∞ g(nTs)ej2πnfst and by the frequency shifting

Practical Interpolation (cont.)

Example: rectangular pulses with Tp < Ts < 1/2B.

p(t) = Π

(

t− 0.5Tp

Tp

)

=⇒ P (f) = Tp sinc(πTpf)e−jπTpf

The transfer function for the equalizer should satisfy

E(f) =

Ts/P (f) |f | < B

whatever B < |f | < 1/Ts −B

0 |f | > 1/Ts −B

To avoid large gain (and noise amplification), we need |P (f)| boundedaway from 0. If |Tpf | < 1 then

sinc(πTpf) > 0

If Tp < 1/2B then P (f) > sin(π/2)/(π/2) = 2/π.

Page 12: SamplingandPulseTrains - Stanford University · 2017. 10. 30. · ej2πnfst (f s = 1 Ts) Thus g = g(t)III(t/Ts) = 1 Ts X∞ n=−∞ g(nTs)ej2πnfst and by the frequency shifting

The Treachery of Aliasing

If we sample too slowly, the shifted spectrums overlap.

High frequency components are “folded” back into the spectrum.This should be avoided.

Page 13: SamplingandPulseTrains - Stanford University · 2017. 10. 30. · ej2πnfst (f s = 1 Ts) Thus g = g(t)III(t/Ts) = 1 Ts X∞ n=−∞ g(nTs)ej2πnfst and by the frequency shifting

Example of Aliasing

cos 4πt sampled at 2 Hz looks like a constant.

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2−1

−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

0.6

0.8

1

Page 14: SamplingandPulseTrains - Stanford University · 2017. 10. 30. · ej2πnfst (f s = 1 Ts) Thus g = g(t)III(t/Ts) = 1 Ts X∞ n=−∞ g(nTs)ej2πnfst and by the frequency shifting

Anti-Aliasing Filter

Page 15: SamplingandPulseTrains - Stanford University · 2017. 10. 30. · ej2πnfst (f s = 1 Ts) Thus g = g(t)III(t/Ts) = 1 Ts X∞ n=−∞ g(nTs)ej2πnfst and by the frequency shifting

Nonideal Practical Sampling

A real-world sampler cannot obtain the value of the signal at an instant.The sampling circuit measures the signal by integration.

g1(nTs) =

∫ Tp

−Tp/2q(t)g(t− nTs) dt

Page 16: SamplingandPulseTrains - Stanford University · 2017. 10. 30. · ej2πnfst (f s = 1 Ts) Thus g = g(t)III(t/Ts) = 1 Ts X∞ n=−∞ g(nTs)ej2πnfst and by the frequency shifting

Nonideal Practical Sampling (cont.)

The values obtained by averaging create a shaped impulse train:

g̃(t) =

∞∑

n=−∞

g1(nTs)δ(t − nTs)

Gating with a rectangle corresponds to transfer function

Ha(F ) = sinc(πTpf)

Thus

G1(f) = H(f)

∞∑

n=−∞

QnG(f − nfs) = sinc(πTpf)

∞∑

n=−∞

QnG(f − nfs)

Page 17: SamplingandPulseTrains - Stanford University · 2017. 10. 30. · ej2πnfst (f s = 1 Ts) Thus g = g(t)III(t/Ts) = 1 Ts X∞ n=−∞ g(nTs)ej2πnfst and by the frequency shifting

Nonideal Practical Sampling (cont.)

We can use the sampling theorem to obtain

G̃(f) =∞∑

n=−∞

Fn(f)G1(f + nfn)

where

Fn(f) =1

Ts

∞∑

ℓ=−∞

Qn sinc((πf + (ℓ+ n)πfs)Tp)

Low pass filtering g̃(t) yields distorted signal with transform F0(f)G(f).

Original signal can be recoverd by equalizer filter.

E(f) =

1/P (f)F0(f) |f | < B

flexible B < |f | < 1/Ts −B

0 |f | > 1/Ts −B

Page 18: SamplingandPulseTrains - Stanford University · 2017. 10. 30. · ej2πnfst (f s = 1 Ts) Thus g = g(t)III(t/Ts) = 1 Ts X∞ n=−∞ g(nTs)ej2πnfst and by the frequency shifting

Pulse Modulation of Signals

◮ In many cases, bandwidth of communication link is much greater thansignal bandwidth.

◮ The signal can be transmitted using short pulses with low duty cycle:

◮ Pulse amplitude modulation: width fixed, amplitude varies

◮ Pulse width modulation: position fixed, width varies

◮ Pulse position modulation: width fixed, position varies

◮ All three methods can be used with time-division multiplexing to carrymultiple signals over a single channel

Page 19: SamplingandPulseTrains - Stanford University · 2017. 10. 30. · ej2πnfst (f s = 1 Ts) Thus g = g(t)III(t/Ts) = 1 Ts X∞ n=−∞ g(nTs)ej2πnfst and by the frequency shifting

PAM, PWM, PPM: Amplitude, Width, Position

Page 20: SamplingandPulseTrains - Stanford University · 2017. 10. 30. · ej2πnfst (f s = 1 Ts) Thus g = g(t)III(t/Ts) = 1 Ts X∞ n=−∞ g(nTs)ej2πnfst and by the frequency shifting

Pulse Amplitude Modulation

◮ The input to a pulse amplitude modulator is the real-world sampleof g(t):

g1(nTs) =

∫ Ts

0

q(t)g(t − nTs) dt

where q(t) is an integrator function. (Width of q(t) should be ≪ Ts.)

◮ Each transmitted pulse is narrow with height (or area) proportionalto g1(nTs). The pulse is integrated to obtain an analog value.

g̃(nTs) =

∫ Tp

0

q1(t)g1(t− nTs) dt

where Tp ≪ Ts

◮ The original signal g(t) is reconstructed using an equalizer and a lowpass filter, as discussed above.

Page 21: SamplingandPulseTrains - Stanford University · 2017. 10. 30. · ej2πnfst (f s = 1 Ts) Thus g = g(t)III(t/Ts) = 1 Ts X∞ n=−∞ g(nTs)ej2πnfst and by the frequency shifting

Pulse Width Modulation (PWM)

Pulse width modulation is also called pulse duration modulation (PDM).

PWM is more often used for control than for communication

◮ Motors

◮ LEDs: output limunosity is proportional to average current.

◮ Amplifiers

A signal can be recovered exactly from its PWM samples at rate 2B,provided the bandwidth is ≤ 0.637B.

J. Huang, K. Padmanabhan, O. M. Collins, IEEE Trans. Circuits and Systems, 2011.

Page 22: SamplingandPulseTrains - Stanford University · 2017. 10. 30. · ej2πnfst (f s = 1 Ts) Thus g = g(t)III(t/Ts) = 1 Ts X∞ n=−∞ g(nTs)ej2πnfst and by the frequency shifting

PWM (cont.)

PWM output can be generated by a sawtooth signal gating the input.

Below the pulse width varies from nearly 0 to 1/2 the pulse period.

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

−1

−0.5

0

0.5

1

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1−0.2

0

0.2

0.4

0.6

0.8

1

Page 23: SamplingandPulseTrains - Stanford University · 2017. 10. 30. · ej2πnfst (f s = 1 Ts) Thus g = g(t)III(t/Ts) = 1 Ts X∞ n=−∞ g(nTs)ej2πnfst and by the frequency shifting

Pulse Position Modulation (PPM)

The value of the signal determines the delay of the pulse from the clock.

Very common in home automation systems.

Microcontrollers can generate PPM (and PWM) in software. Doesn’trequire an D/A.

Many Arduinos use PWM to generate analog output waveforms.