Post on 25-May-2020
Sampling
ELEC 3004: Signals, Systems & Control
Dr. Surya Singh, Prof. Brian Lovell & Dr. Paul Pounds
Lecture # 3 March 8, 2012
elec3004@itee.uq.edu.au
http://courses.itee.uq.edu.au/elec3004/2012s1/© 2012 School of Information Technology and Electrical Engineering at the University of Queensland
2
Schedule of Events
1 1-Mar Overview5-Mar Signals & Systems
8-Mar Sampling12-Mar LTI & Laplace Transforms15-Mar Convolution19-Mar Discrete Fourier Series22-Mar Fourier Transform26-Mar Fourier Transform Operations29-Mar Applications: DFFT and DCT
2-Apr Exam 1 (10%)5-Apr (Guest Lecture from Industry)
16-Apr Data Acquisition & Interpolation19-Apr Noise23-Apr Filters & IIR Filters26-Apr FIR Filters30-Apr Multirate Filters3-May Filter Selection7-May Holiday
10-May Quiz (10%)14-May z-Transform17-May Introduction to Digital Control21-May Stability of Digital Systems24-May Estimation28-May Kalman Filters & GPS31-May Applications in Industry
13
7
8
9
10
11
12
6
2
3
4
5
3
Annoucements
• Practicals next week!
Therefore, No Tutorials next week
• Practical 1: Pre-lab will be posted this evening!
• No Pre-Lab == No Lab Admission
• Please go to the lab you have been assigned to!
4
Introduction
• Most naturally occurring signals are continuous-valued – continuous-time (CT) and continuous-value (CV)
• Analogue system, e.g., analogue filter– problems: component tolerances, variation with temperature and age
– limited to time invariant systems (non-adaptive)
• Digital System (DSP: software, VLSI, or FPGA)– can replace analogue systems, more robust
– can also implement adaptive and non-linear fctns• still some issues: quantisation, aliasing (later)
5
Analogue & Digital Systems
x(t) y(t) AnalogueFilter
Analogue System
x(t)y(t)
Digital System
sampling quantis-ation
DSPreconst-ruction
Key: CT= continuous-time, CV = continuous-valued, DT = discrete-time, DV = discrete valued
CT, CV DT, CV DT, DV CT, CV
x[n] y[n]
6
Mathematics of Sampling and Reconstruction
DSPIdealLPF
x(t) xc(t) y(t)
Impulse train δT(t)=∑δ(t - n∆t)
… …t
Sampling frequency fs = 1/∆t
Gain
fc Freq
1
0
Cut-off frequency = fc
reconstructionsampling
7
Mathematical Model of Sampling
• x(t) multiplied by impulse train δT(t)
• xc(t) is a train of impulses of height x(t)|t=n∆t
[ ]∑ ∆−∆=
+∆−+∆−+==
n
Tc
tnttnx
ttttttx
ttxtx
)()(
)2()()()(
)()()(
δδδδ
δL
8
-10 -8 -6 -4 -2 0 2 4 6 8 10-2
-1
0
1
2
t
x(t)
Continuous-time
-10 -8 -6 -4 -2 0 2 4 6 8 10-2
-1
0
1
2
t
x c(t
)
Discrete-time
9
Frequency Domain Analysis of Sampling
• Consider the case where the DSP performs no filtering operations– i.e., only passes xc(t) to the reconstruction filter
• To understand we need to look at the frequency domain
• Sampling: we know – multiplication in time ≡ convolution in frequency
– F{x(t)} = X(w)
– F{δT(t)} = ∑δ(w - 2πn/∆t), – i.e., an impulse train in the frequency domain
10
Frequency Domain Analysis of Sampling
• In the frequency domain we have
∑
∑
∆−
∆=
∆−
∆=
n
nc
t
nwX
t
t
nw
twXwX
π
πδππ
21
22*)(
2
1)(
� Let’s look at an example� where X(w) is triangular function
� with maximum frequency wm rad/s
� being sampled by an impulse train, of frequency ws rad/s
Rememberconvolution with
an impulse?Same idea for an
impulse train
11
Fourier transform of original signal X(ω) (signal spectrum)
w-wm wm
w
……
Fourier transform of impulse train δT(ω/2π) (sampling signal)
0 ws = 2π/∆t 4π/∆t
Original spectrumconvolved withspectrum ofimpulse train…
Fourier transform of sampled signal
w
…
Original Replica 1 Replica 2
1/∆t
12
Spectrum of reconstructed signal
w-wm wm
Reconstruction filterremoves the replica spectrums & leavesonly the original
Reconstruction filter (ideal lowpass filter)
w-wc wc = wm
∆t
…
Spectrum of sampled signal
w
…
Original Replica 1 Replica 2
1/∆t
13
Sampling Frequency
• In this example it was possible to recover the original signal from the discrete-time samples
• But is this always the case?
• Consider an example where the sampling frequency ws is reduced – i.e., ∆t is increased
14
Original Spectrum
w-wm wm
Replica spectrumsoverlap with original(and each other)This is Aliasing
w
……
Fourier transform of impulse train (sampling signal)
0 2π/∆t 4π/∆t 6π/∆t
…
Amplitude spectrum of sampled signal
w
…
Original Replica 1 Replica 2 …
15
Due to overlappingreplicas (aliasing) the reconstruction filter cannot recoverthe original spectrum
Reconstruction filter (ideal lowpass filter)
w-wc wc = wm
Spectrum of reconstructed signal
w-wm wm
…
Amplitude spectrum of sampled signal
w
…
Original Replica 1 Replica 2 …
sampled signalspectrum
The effect of aliasing isthat higher frequenciesof “alias to” (appear as)
lower frequencies
16
Sampling Theorem
• The Nyquist criterion states:
To prevent aliasing, a bandlimitedbandlimitedbandlimitedbandlimited signal of bandwidth wB
rad/s must be sampled at a rate greater than 2wB rad/s
–ws > 2wBNote: this is a > sign not a ≥
Also note: Most real world signals require band-limitingwith a lowpass (anti-aliasing) filter
17
Time Domain Analysis of Sampling
• Frequency domain analysis of sampling is very useful to understand
– sampling (X(w)*∑ δ(w - 2πn/∆t) ) – reconstruction (lowpass filter removes replicas)
– aliasing (if ws ≤ 2wB)
• Time domain analysis can also illustrate the concepts
– sampling a sinewave of increasing frequency
– sampling images of a rotating wheel
18
Original signal
Discrete-time samples
Reconstructed signal
A signal of the original frequency is reconstructed
19
Original signal
Discrete-time samples
Reconstructed signal
A signal with a reduced frequency is recovered, i.e., the signal is aliased to a lower frequency (we recover a replica)
20
Sampling < Nyquist ���� Aliasing
0 5 10 15-1.5
-1
-0.5
0
0.5
1
1.5
time
sig
nal
True signalAliased (under sampled) signal
21
Nyquist is not enough …
0 1 2 3 4 5 6 7-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
11Hz Sin Wave: Sin(2πt) → 2 Hz Sampling
Time(s)
Nor
mal
ized
mag
nitu
de
22
A little more than Nyquist is not enough …
0 1 2 3 4 5 6 7-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
11Hz Sin Wave: Sin(2πt) → 4 Hz Sampling
Time(s)
Nor
mal
ized
mag
nitu
de
23
Sampled Spectrum ws > 2wm
w-wm wm ws
orignal replica 1 …
…
LPF
original freq recovered
Sampled Spectrum ws < 2wm
w-wm wmws
…
orignal …
replica 1
LPFOriginal and replica
spectrums overlapLower frequency recovered (ws – wm)
24
Temporal Aliasing
90o clockwise rotation/frameclockwise rotation perceived
270o clockwise rotation/frame(90o) anticlockwise rotation perceived i.e., aliasing
Require LPF to ‘blur’ motion
25
Time Domain Analysis of Reconstruction• Frequency domain: multiply by ideal LPF
– ideal LPF: ‘rect’ function (gain ∆t, cut off wc)
– removes replica spectrums, leaves original
• Time domain: this is equivalent to– convolution with ‘sinc’ function
– as F -1{∆t rect(w/wc)} = ∆t wc sinc(wct/π)– i.e., weighted sinc on every sample
• Normally, wc = ws/2
∑∞
−∞=
∆−∆∆=n
ccr
tntwtwtnxtx
π)(
sinc)()(
26
-4 -3 -2 -1 0 1 2 3 4
-0.2
0
0.2
0.4
0.6
0.8
1
Sample
Val
ue
Ideal "sinc" Interpolation of sample values [0 0 0.75 1 0.5 0 0]
reconstructed signal xr(t)
27
Sampling and Reconstruction Theory and Practice
• Signal is bandlimited to bandwidth WB
– Problem: real signals are not bandlimited• Therefore, require (non-ideal) anti-aliasing filter
• Signal multiplied by ideal impulse train– problems: sample pulses have finite width
– and not ⊗ in practice, but sample & hold circuit
• Samples discrete-time, continuous valued– Problem: require discrete values for DSP
• Therefore, require A/D converter (quantisation)
• Ideal lowpass reconstruction (‘sinc’ interpolation)– problems: ideal lowpass filter not available
• Therefore, use D/A converter and practical lowpass filter
28
Practical DSP System
Anti-aliasing Filter
Sample and
Hold
A/D Converter
D/A Converter
DSP Processor
Recon-struction
Filter
DSP Boardx(t)
y(t)
ws
wc < ws/2
wc = ws/2
Note: ws > 2wBBW: wB
29
Practical Anti-aliasing Filter• Non-ideal filter
– wc = ws /2
• Filter usually 4th – 6th order (e.g., Butterworth)– so frequencies > wc may still be present
– not higher order as phase response gets worse
• Luckily, most real signals– are lowpass in nature
• signal power reduces with increasing frequency
– e.g., speech naturally bandlimited (say < 8KHz)
– Natural signals have a (approx) 1/f spectrum
– so, in practice aliasing is not (usually) a problem
30
Finite Width Sampling• Impulse train sampling not realisable
– sample pulses have finite width (say nanosecs)
This produces two effects,
1. Impulse train has sinc envelope in frequency domain– impulse train is square wave with small duty cycle
– Reduces amplitude of replica spectrums• smaller replicas to remove with reconstruction filter ☺
2. Averaging of signal during sample time– effective low pass filter of original signal
• can reduce aliasing, but can reduce fidelity �
• negligible with most S/H ☺
31
Amplitude spectrum of original signal
w-wm wm
…
Fourier transform of sampled signal
w
…
Original Replica 1 Replica 2
1/∆t
w
……
Fourier transform of sampling signal (pulses have finite width)
0 ws = 2π/∆t 4π/∆t
sinc envelopeZero at harmonic
1/duty cycle
32
Practical Sampling• Sample and Hold (S/H)
1. takes a sample every ∆t seconds2. holds that value constant until next sample
• Produces ‘staircase’ waveform, x(n∆t)
t
x(t)
hold for ∆t
sample instant
x(n∆t)
33
Quantisation
• Analogue to digital converter (A/D)– Calculates nearest binary number to x(n∆t)
• xq[n] = q(x(n∆t)), where q() is non-linear rounding fctn– output modeled as xq[n] = x(n∆t) + e[n]
• Approximation process– therefore, loss of information (unrecoverable)
– known as ‘quantisation noise’ (e[n])
– error reduced as number of bits in A/D increased• i.e., ∆x, quantisation step size reduces
2][
xne
∆≤
34
Input-output for 4-bit quantiser(two’s compliment)
Analogue
Digital7 01116 01105 0101
4 01003 00112 00101 00010 0000-1 1111-2 1110-3 1101-4 1100
-5 1011-6 1010-7 1000
∆x
quantisationstep size
12
2
−=∆
m
Ax
where A = max amplitudem = no. quantisation bits
35
0 1 2 3 4 5 6 7 8 9 100
2
4
6
8
10
12
14
16
Sample number
Am
plitu
de (
V)
original signal x(t) quantised samples xq(t)
Example: error due to signal quantisation
36
Signal to Quantisation Noise
• To estimate SQNR we assume
– e[n] is uncorrelated to signal and is a
– uniform random process
• assumptions not always correct!
– not the only assumptions we could make…
• Also known a ‘Dynamic range’ (RD)
– expressed in decibels (dB)
– ratio of power of largest signal to smallest (noise)
=
noise
signalD P
PR 10log10
37
38
Dynamic Range
Need to estimate:
1. Noise power– uniform random process: Pnoise= ∆x2/12
2. Signal power– (at least) two possible assumptions
1. sinusoidal: Psignal = A2/2
2. zero mean Gaussian process: Psignal= σ2
• Note: as σ ≈ A/3: Psignal ≈ A2/9
• where σ2 = variance, A = signal amplitude
Regardless of assumptions: RD increases by 6dBfor every bit that is added to the quantiser
1 extra bit halves ∆xi.e., 20log10(1/2) = 6dB
39
Practical Reconstruction
Two stage process:
1. Digital to analogue converter (D/A)– zero order hold filter
– produces ‘staircase’ analogue output
2. Reconstruction filter– non-ideal filter: wc = ws /2
– further reduces replica spectrums
– usually 4th – 6th order e.g., Butterworth • for acceptable phase response
40
D/A Converter
• Analogue output y(t) is
– convolution of output samples y(n∆t) with hZOH(t)
2/
)2/sin(
2exp)(
otherwise,0
0,1)(
)()()(
tw
twtjwtwH
ttth
tnthtnyty
ZOH
ZOH
ZOHn
∆∆
∆−∆=
∆<≤
=
∆−∆=∑
D/A is lowpass filter with sinc type frequency responseIt does not completely remove the replica spectrumsTherefore, additional reconstruction filter required
41
Zero Order Hold (ZOH)
ZOH impulse response
ZOH amplitude response
ZOH phase response
42
0 1 2 3 4 5 6 7 8 9 100
2
4
6
8
10
12
14
16
Time (sec)
Am
plitu
de (
V)
output samples
D/A output
‘staircase’ output from D/A converter (ZOH)
43
Smooth output from reconstruction filter
0 2 4 6 8 10 122
4
6
8
10
12
14
16
Time (sec)
Am
plitu
de (
V)
D/A output Reconstruction filter output
44
Original S ignal A fter Anti-alias ing LPF After S am ple & Hold
A fter Recons truc tion LPF After A /DAfter D/A
Complete practical DSP system signals DSP
45
Summary
• Theoretical model of Sampling– bandlimited signal (wB)
– multiplication by ideal impulse train (ws > 2wB)• convolution of frequency spectrums (creates replicas)
– Ideal lowpass filter to remove replica spectrums• wc = ws /2
• Sinc interpolation
• Practical systems– Anti-aliasing filter (wc < ws /2)
– A/D (S/H and quantisation)
– D/A (ZOH)
– Reconstruction filter (wc = ws /2)
Don’t confuse theory and
practice!
46
Questions1. A 7 kHz sine wave is sampled at 10 kHz. What frequencies are present at the
output of the A2D?
2. Determine the voltage and power ratios of a pair of sinusoidal signals that have a 3dB ratio.
3. A 1 kHz ±5 V sine wave is applied to a 14-bit A2D operating from a ±10 V supply sampling at 10 kHz. What is the SQNR of the A2D in dB?
47
Questions1. ±7, 10 – 7 = ±3, 10 + 7 = ±17, 20 – 7 = ± 13, …
– Note aliasing and symmetry of spectrum
2. Rearrange: 3 = 10log10(P1/P2) = 103/10 = 2
– Rearrange: 3 = 20log10(V1/V2) = 103/20 = √2
3. A2D resolution: ∆x = (2x10)/(214 – 1)– Pnoise = ∆x2/12– Psignal = 5
2/2
dBP
PSQNR
noise
signal
= 10log10