You are on page 1of 36

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
Continuous function V Discrete function Vk of
of continuous variable t
Sampled discrete sampling
(time, space etc) : V(t). Signal variable tk, with k =
integer: Vk = V(tk).

0.3 0.3
0.2 0.2
Voltage [V]

Voltage [V]
0.1 0.1
0 0
-0.1 -0.1 ts ts
-0.2 -0.2
0 2 4 6 8 10 0 2 4 6 8 10
time [ms] sampling time, tk [ms]
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

• More flexible. • A/D & signal processors speed:


wide-band signals still difficult to
• Often easier system upgrade. treat (real-time systems).
• Data easily stored -memory. • Finite word-length effect.
• Better control over accuracy
requirements.
• Reproducibility.
• Linear phase
• No drift with time and
temperature

5/36
DSPing: aim & tools
• Predicting a system’s output.
Applications • Implementing a certain processing task.
• Studying a certain signal.

• General purpose processors (GPP), -controllers.


Hardware • Digital Signal Processors (DSP). Fast real-time
Faster DSPing
• Programmable logic ( PLD, FPGA ).

• Programming languages: Pascal, C / C++ ...


Software • “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 δ(n)=1 for n=0

u(nTs)
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
V

DOMAIN
ANALOG
General scheme Filter
ms
Filter
Antialiasing
V
Antialiasing
Sometimes steps missing
ms
- Filter + A/D A
A/D
A/D

DOMAIN
DIGITAL
(ex: economics);
k
- D/A + filter Digital
Processing
Digital
A
(ex: digital output wanted).
k Processing
V
D/A

DOMAIN
ANALOG
Topics of this ms
Filter
V
lecture. Reconstruction

ms

10/36
Digital system implementation
KEY DECISION POINTS:
ANALOG INPUT
Analysis bandwidth, Dynamic range

Antialiasing
Filter • Pass / stop bands.
1
• Sampling rate.
A/D
• No. of bits. Parameters. 2
Digital
Processing • Digital format. 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) Condition on fS?
F1 F2 F3

F1=25 Hz, F2 = 150 Hz, F3 = 50 Hz 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 f

(b) Discrete spectrum


No aliasing
(b) Time sampling frequency
repetition.
fS > 2 B no aliasing.
-B 0 B fS/2 f

Discrete spectrum
(c) Aliasing & corruption
(c) fS 2B aliasing !

Aliasing: signal ambiguity


0 fS/2 f in frequency domain

19/36
1 Antialiasing filter
(a) Signal of interest (a),(b) Out-of-band noise can aliase
Out of band
Out of band into band of interest. Filter it before!
noise
noise

-B 0 B f
(c) Antialiasing filter
(b) Passband: depends on bandwidth of
interest.

Attenuation AMIN : depends on


-B 0 B fS/2 • ADC resolution ( number of bits N).
(c) f
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 Bandpass signal
B
sampling frequency fS req’ments. centered on fC

0 fC
2  fC  B 2  fC  B
 fS  f
m 1 m

m , selected so that fS > 2B

-fS 0 fS 2fS
f fC
Example
fC = 20 MHz, B = 5MHz Advantages
Without under-sampling fS > 40 MHz.  Slower ADCs / electronics
With under-sampling fS = 22.5 MHz (m=1);
needed.

= 17.5 MHz (m=2); = 11.66 MHz (m=3).  Simpler antialiasing filters.

21/36
Quantization and Coding
N Quantization Levels

Quantization Noise

22/36
2 SNR of ideal ADC
 RMS input  Assumptions
SNRideal  20  log10   (1)
 RMS(e q )   Ideal ADC: only quantisation error eq
 
(p(e) constant, no stuck bits…)
Also called SQNR
 eq uncorrelated with signal.
(signal-to-quantisation-noise ratio)
 ADC performance constant in time.

T 2
RMS input 
1  VFSR
 
 V
 sinωt  dt  FSR
Input(t) = ½ VFSR sin( t).
T  2  2 2
0
p(e)
quantisation error probability density

q/2
RMS(e q )    
eq2  p eq deq 
q

VFSR
12 2N  12
1
q
-q/2

(sampling frequency fS = 2 fMAX) q q eq


2 2
Error value

23/36
2 SNR of ideal ADC - 2
Substituting in (1) : SNRideal  6.02  N  1.76 [dB] (2)

One additional bit 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 (a) The oversampling process takes apart
Oversampling OSR=4
the images of the signal band.

f
(b) fs=4fN
PSD
Quantization noise in When the sampling rate increases (4
Signal Nyquist converters
times) the quantization noise spreads
Quantization noise in over a larger region. The quantization
Oversampling converters
noise power in the signal band is 4 times
0 fN/2
smaller.
fs/2

Quantization noise
PSD
Signal
Quantization noise Oversampling and noise Spectrum at the output of a noise
Nyquist converters shaping converters
shaping quantizer loop compared to
Quantization noise
Oversampling converters those obtained from Nyquist and
Oversampling converters.
0 FN/2 frequency 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 N
• linear
•Time Invariant
y ( n )   ak x ( n  k )
•Stable k 0
Convolution
•Causal

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
y (n)   ak x(n  k )   bk y (n  k )
k 0 k 1

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


x1(n) x12(n)
x2

Non-linear
x1(n)+x2(n) x12(n)+x22(n)+2 x1(n) x2(n)
x2
x2(n) x22(n)
2
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

You might also like