Upload
dinhdien
View
226
Download
3
Embed Size (px)
Citation preview
Basics on Digital Signal Processing
Introduction
Vassilis Anastassopoulos
Electronics Laboratory, Physics Department,
University of Patras
2/36
Outline of the Course
1. Introduction (sampling – quantization)
2. Signals and Systems
3. Z-Transform
4. The Discreet and the Fast Fourier Transform
5. Linear Filter Design
6. Noise
7. Median Filters
3/36
-0.2
-0.1
0
0.1
0.2
0.3
0 2 4 6 8 10sampling time, tk [ms]
Vo
lta
ge
[V
]
ts
-0.2
-0.1
0
0.1
0.2
0.3
0 2 4 6 8 10sampling time, tk [ms]
Vo
lta
ge
[V
]
ts
Analog & digital signals
Continuous function V
of continuous variable t
(time, space etc) : V(t).
Analog Discrete function Vk of
discrete sampling
variable tk, with k =
integer: Vk = V(tk).
Digital
-0.2
-0.1
0
0.1
0.2
0.3
0 2 4 6 8 10
time [ms]
Vo
lta
ge
[V
]
Uniform (periodic) sampling. Sampling frequency fS = 1/ tS
Sampled Signal
4/36
Analog & digital systems
5/36
Digital vs analog processing Digital Signal Processing (DSPing)
• More flexible.
• Often easier system upgrade.
• Data easily stored -memory.
• Better control over accuracy
requirements.
• Reproducibility.
• Linear phase
• No drift with time and
temperature
Advantages
• A/D & signal processors speed:
wide-band signals still difficult to
treat (real-time systems).
• Finite word-length effect.
Limitations
6/36
DSPing: aim & tools
Software • Programming languages: Pascal, C / C++ ...
• “High level” languages: Matlab, Mathcad, Mathematica…
• Dedicated tools (ex: filter design s/w packages).
Applications • Predicting a system’s output.
• Implementing a certain processing task.
• Studying a certain signal.
• General purpose processors (GPP), -controllers.
• Digital Signal Processors (DSP).
• Programmable logic ( PLD, FPGA ).
Hardware real-time DSPing
Fast
Faster
7/36
Related areas
8/36
Applications
9/36
Important digital signals
Unit Impulse or Unit Sample.
The most important signal for
two reasons
δ(n)=1 for n=0
Unit Step u(n)=1 for n0
δ(n)=u(n)-u(n-1)
Unit Ramp r(n)=nu(n)
δ(nTs) δ[(n-3)Τs]
nΤs past
u(nTs)
nΤs past
r(nTs)
nΤs past
10/36
Digital system example
ms
V ANALOG
DOM
AIN
ms
V
Filter Antialiasing
k
A DIGITAL
DOM
AIN
A/D
k
A
Digital Processing
ms
V ANALOG
DOM
AIN
D/A
ms
V Filter Reconstruction
Sometimes steps missing
- Filter + A/D
(ex: economics);
- D/A + filter
(ex: digital output wanted).
General scheme
Topics of this lecture.
Digital Processing
Filter
Antialiasing
A/D
11/36
Digital system implementation
• Sampling rate.
• Pass / stop bands.
KEY DECISION POINTS:
Analysis bandwidth, Dynamic range
• No. of bits. Parameters.
1
2
3 Digital
Processing
A/D
Antialiasing Filter
ANALOG INPUT
DIGITAL OUTPUT
• Digital format.
What to use for processing?
12/36
AD/DA Conversion – General Scheme
13/36
AD Conversion - Details
14/36
Sampling
15/36
Sampling
How fast must we sample a continuous signal to preserve its info content?
Ex: train wheels in a movie.
25 frames (=samples) per second.
Frequency misidentification due to low sampling frequency.
Train starts wheels ‘go’ clockwise.
Train accelerates wheels ‘go’ counter-clockwise.
1
Why?
16/36
Rotating Disk
How fast do we have to instantly stare at the disk if it rotates with frequency 0.5 Hz?
17/36
The sampling theorem
A signal s(t) with maximum frequency fMAX can be recovered if sampled at frequency fS > 2 fMAX .
Condition on fS?
fS > 300 Hz
t)cos(100πt)πsin(30010t)πcos(503s(t)
F1=25 Hz, F2 = 150 Hz, F3 = 50 Hz
F1 F2 F3
fMAX
Example
1
Theo*
* Multiple proposers: Whittaker(s), Nyquist, Shannon, Kotel’nikov.
Nyquist frequency (rate) fN = 2 fMAX or fMAX or fS,MIN or fS,MIN/2 Naming gets
confusing !
18/36
Sampling and Spectrum
19/36
Sampling low-pass signals
-B 0 B f
Continuous spectrum (a) Band-limited signal:
frequencies in [-B, B] (fMAX = B). (a)
-B 0 B fS/2 f
Discrete spectrum
No aliasing (b) Time sampling frequency
repetition.
fS > 2 B no aliasing.
(b)
1
0 fS/2 f
Discrete spectrum
Aliasing & corruption (c) (c) fS 2 B aliasing !
Aliasing: signal ambiguity in frequency domain
20/36
Antialiasing filter
-B 0 B f
Signal of interest
Out of band noise
Out of band noise
-B 0 B fS/2
f
(a),(b) Out-of-band noise can aliase
into band of interest. Filter it before!
(a)
(b)
(c)
Passband: depends on bandwidth of
interest.
Attenuation AMIN : depends on
• ADC resolution ( number of bits N).
AMIN, dB ~ 6.02 N + 1.76
• Out-of-band noise magnitude.
Other parameters: ripple, stopband
frequency...
(c) Antialiasing filter
1
21/36
Under-sampling 1
Using spectral replications to reduce sampling frequency fS req’ments.
m
BCf2Sf
1m
BCf2
m , selected so that fS > 2B
B
0 fC
f
Bandpass signal
centered on fC
-fS 0 f
S 2f
S
f fC
Advantages
Slower ADCs / electronics
needed.
Simpler antialiasing filters.
fC = 20 MHz, B = 5MHz
Without under-sampling fS > 40 MHz.
With under-sampling fS = 22.5 MHz (m=1);
= 17.5 MHz (m=2); = 11.66 MHz (m=3).
Example
22/36
Quantization and Coding
q
N Quantization Levels
Quantization Noise
23/36
SNR of ideal ADC 2
)qRMS(e
inputRMS10log20idealSNR (1)
Also called SQNR
(signal-to-quantisation-noise ratio)
Ideal ADC: only quantisation error eq (p(e) constant, no stuck bits…)
eq uncorrelated with signal.
ADC performance constant in time.
Assumptions
22
FSRVT
0
dt2
ωtsin2
FSRV
T
1inputRMS
Input(t) = ½ VFSR sin( t).
12N2
FSRV
12
qq/2
q/2-
qdeqep2qe)qRMS(e
eeqq
Error value
pp((ee)) quantisation error probability density
1 q
q 2
q 2
(sampling frequency fS = 2 fMAX)
24/36
SNR of ideal ADC - 2
[dB]1.76N6.02SNRideal (2) Substituting in (1) :
One additional bit SNR increased by 6 dB
2
Actually (2) needs correction factor depending on ratio between sampling freq
& Nyquist freq. Processing gain due to oversampling.
- Real signals have noise.
- Forcing input to full scale unwise.
- Real ADCs have additional noise (aperture jitter, non-linearities etc).
Real SNR lower because:
25/36
Coding - Conventional
26/36
Coding – Flash AD
27/36
DAC process
28/36
Oversampling – Noise shaping
fs=4fN (b)
(a)
f
f fN
Oversampling OSR=4
Nyquist Sampler PSD
fb The oversampling process takes apart
the images of the signal band.
PSD
fN/2 0
Signal Quantization noise in
Nyquist converters
fs/2
Quantization noise in
Oversampling converters
When the sampling rate increases (4
times) the quantization noise spreads
over a larger region. The quantization
noise power in the signal band is 4 times
smaller.
frequency
PSD
FN/2 0
Signal Quantization noise
Nyquist converters
Fs/2
Quantization noise
Oversampling converters
Quantization noise
Oversampling and noise
shaping converters Spectrum at the output of a noise
shaping quantizer loop compared to
those obtained from Nyquist and
Oversampling converters.
29/36
A discreet-time system is a device or algorithm that operates on an input sequence according to some computational procedure
Digital Systems
It may be •A general purpose computer •A microprocessor •dedicated hardware •A combination of all these
30/36
Linear, Time Invariant Systems
N
k
k knxany0
)()(System Properties • linear •Time Invariant •Stable •Causal
Convolution
31/36
Linear Systems - Convolution
5+7-1=11 terms
32/36
Linear Systems - Convolution
5+7-1=11 terms
33/36
L
k
k
M
k
k knybknxany10
)()()(
General Linear Structure
34/36
Simple Examples
35/36
Linearity – Superposition – Frequency Preservation
Principle of Superposition
H
y1(n) x1(n)
H
y2n) x2(n)
H
ay1(n)+by2(n) ax1(n)+bx2(n)
Principle of Superposition Frequency Preservation
x2
x12(n) x1(n)
x2(n)
x1(n)+x2(n)
x2
x2
x22(n)
x12(n)+x2
2(n)+2 x1(n) x2(n)
If y(n)=x2(n) then for x(n)=sin(nω) y(n)=sin2(nω)=0.5+0.5cos(2nω)
Non-linear
36/36
The END
Back on Tuesday
Have a nice Weekend