Basics on Digital Signal Processing

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