Upload
andres-rn
View
226
Download
0
Embed Size (px)
Citation preview
8/12/2019 Sampling Impr
1/57
Basic sampling theory
8/12/2019 Sampling Impr
2/57
Overview
Introduction/motivation
Sampling basics
A/D conversion
Nyquist frequency
Binary numbers and quantiation
!achine representation
Bitwise operations in " Summary
8/12/2019 Sampling Impr
3/57
#ou may have heard of$$$
%oltage and current &Ohm's law( )%*( )"*+
Operational amplifiers
*inear dynamic circuits
Sinusoidal signals
Analog filters
All of these concepts aredefined in continuous time
8/12/2019 Sampling Impr
4/57
,lectronic systems
In the -old days. people constructed all electronic systemsusing purely analog devices
*ower verticaldeflection plate
"athode
"ontrol electronicslass tube&vacuum+
0pper verticaldeflection plate0pper verticaldeflection plate
8/12/2019 Sampling Impr
5/57
,lectronic systems
,lectronic systems are very often used together with non1electronic devices2 motors( loudspea3ers( antennas( *,Ddisplays( etc$ etc$
4achometer
%oltage proportional to speed
5egulator
!otor current
D"1motor
8/12/2019 Sampling Impr
6/57
!odern electronic systems
5oughly since the 6789's( analogsystems have gradually beenreplaced with digital designs(because2
4hey are cheaper
4hey are easier to design
4hey are (re-)programmable
8/12/2019 Sampling Impr
7/57
A general system framewor3
System/reality !otor :uman ear Atmosphere Supertan3er
Actuator ;ower supply :eadphones Antenna 5udder( engine( propeller
Sensor 4achometer !icrophone Antenna ;S receiver
Computer Speed controller !;< encoding =iltering 5oute planning
Analog/ContinuousDigital/Discrete
8/12/2019 Sampling Impr
8/57
"ontinuous signals
4he signals and physical phenomena we observe around us arenormally continuous:
"urrents and voltages in the power grid
>ater flow in a district heating system
5otation speed of an engine
,tc$ etc$$$
8/12/2019 Sampling Impr
9/57
,lectrocardiogram
8/12/2019 Sampling Impr
10/57
,lectromyogram
8/12/2019 Sampling Impr
11/57
Signals vs$ components
"omponent/subsystem
"omponent/subsystem
"omponent/subsystem
"omponent/subsystem
SignalSignal
SignalSignal
8/12/2019 Sampling Impr
12/57
Discretiation of signals
"omputers only -understand. -numbers. :ence( continuous signals must be discretizedin order for
computers to be able to process them
4his is 3nown assampling
Discrete time"ontinuous time
Am
plitude
Am
plitude
8/12/2019 Sampling Impr
13/57
Sampling
"ontinuous time2 x x&t+( x R! t R
Discrete time2 x x&t+( x R! t "#! # R+! " Z
After sampling( we obtain ase$uence o% discrete &alues2
x" x&"#+
# ? s @ is calledsampling time
%s 6/4 ? : @ is called thesampling %re$uency
&sometimes also given in ?rad/s@+
8/12/2019 Sampling Impr
14/57
Sampling 1 schematics
4imerAlgorithm
A/D converter
Actuator
Sensor
D/A converter
8/12/2019 Sampling Impr
15/57
A/D "onversion the result
"ontinuous1timesignal
Sampled signal
Sampling process
8/12/2019 Sampling Impr
16/57
Information in sampled signals
Say we want to sample the following sinusoidal signalC how dowe choose an appropriate sampling frequency
8/12/2019 Sampling Impr
17/57
Sampling with E9 :
8/12/2019 Sampling Impr
18/57
Sampling with F9 :
8/12/2019 Sampling Impr
19/57
Sampling with 699 :
8/12/2019 Sampling Impr
20/57
Sampling with 6EG :
8/12/2019 Sampling Impr
21/57
Sampling with E99 :
8/12/2019 Sampling Impr
22/57
Sampling with
8/12/2019 Sampling Impr
23/57
Sampling with G99 :
8/12/2019 Sampling Impr
24/57
Nyquist frequency
4he Nyquist1Shannon sampling theorem2
'% a %unctionx(t)contains no %re$uencies higher than hertz! itis completely determined by gi&ing its ordinates at a series o%points spaced / &*+seconds apart+
"onversely( it isimpossibleto reconstruct a continuous1timesinusoidal signal containing frequencies higher than half thesampling frequencyH 4his frequency is called the,y$uist%re$uency
In practice( it is difficult to detect frequencies of more than about of the sampling frequency
8/12/2019 Sampling Impr
25/57
8/12/2019 Sampling Impr
26/57
Sinusoidal signal models
Loseph =ourier discovered that anyrepetiti&e signal may be written asa &potenitially infinite+sum o%sines/cosines
and.idthrefers to the frequencieswhere the amplitude of thesine/cosine components have non1negligible amplitude$
Loseph =ourier( 68M16
8/12/2019 Sampling Impr
27/57
8/12/2019 Sampling Impr
28/57
=requency spectrum
A frequency spectrum is a graph that shows how much 'power'each sinusoidal component contributes with
9
A
%
E$< :
6$7 sin&9$ t+
9$E sin&E$< t+
9$7 sin&$< t+
9$ : $< :
8/12/2019 Sampling Impr
29/57
Aliasing
In old movies you could sometimes see wagon wheels rotating-bac3wards. 1 this is an optical illusion caused by a limitedsampling frequency in the film cameras used$
li i
8/12/2019 Sampling Impr
30/57
Aliasing
Image E Image 6Image hen a frequency in a continuous1time signal eJceeds theNyquist1frequency( but is still below the actual samplingfrequency( we see a -reflection. of that frequency in the sampledsignalC this is 3nown as aliasing
Increasing frequency content in an
8/12/2019 Sampling Impr
32/57
Increasing frequency content in ananalog signal( fiJed%
s
"omp ting the freq enc of the
8/12/2019 Sampling Impr
33/57
"omputing the frequency of thealiased signal
4he frequency of the aliased signal(%a( is found via the
eJpression
%a&,+ P%, %
sP
%sis the sampling frequency
%is the actual signal frequency , is an integer
8/12/2019 Sampling Impr
34/57
=or eJample$$$
=ind%a if%s is 6EG : and% is 699 :
4est different values of, in the eJpression%a&,+ P%, %
sP
, 6 2 f = 125 100 = 25
N= 2 : f = |125 200| = 75N= 3 : f = |125 300| = 175
We can thus expect to see an aliased signal component at25 H!
Sampling a 699 : signal with
8/12/2019 Sampling Impr
35/57
p g g%
s 6EG :
4wo and a half wave in9$6 s
Q -oscillation. at EG :
8/12/2019 Sampling Impr
36/57
:ow to avoid aliasing
;re1filter the signal before sampling
*owpass1filter A/D "onverter
Analog signal affectedby unwantedfrequencies
Analog signal containingonly relevant &low+frequencies
Digital signal
8/12/2019 Sampling Impr
37/57
Bac3 to A/D "onversion
"ontinuous1timesignal
Sampled signal
Sampling process
ObsHinaryrepresentation of
sampled signal
8/12/2019 Sampling Impr
38/57
Binary numbers
Binary numbers with ndigits can representdifferent values
,$g$ for n
8/12/2019 Sampling Impr
39/57
Ruantiation
Numbers represented by binary digits are countable thismeans that not all real numbers can be represented on acomputer
But we can get arbitrarily close by increasing the number of
digits
8/12/2019 Sampling Impr
40/57
Ruantiation error
,ach bit corresponds to avoltage interval
:ence( quantiation leads to a
$uantization errorqof at
most the same sie as thisinterval &+
Best1case &5ounding off+2
q" #
8/12/2019 Sampling Impr
41/57
Summary
A/D conversion is a way of representing continuous signals asdiscrete values
)eywords2 discretization and $uantization
Sampled &aluesare represented in a computer using binarydigits
4ime
Amplitude
4ime
Amplitude
S
8/12/2019 Sampling Impr
42/57
Summary
It is not possible to reconstruct sinusoidal signals containingfrequencies higher than half the sampling frequency the,y$uist %re$uency
Normally( a sensible choice of sampling frequency is G to E9
times the highest frequency -of interest. to the application(called the band.idth
>hen sampling signals with lots of frequencies( you need to beaware of aliasing
On the slides after this( you will find some reference materialthat you might find of relevance later
8/12/2019 Sampling Impr
43/57
A/D " i t b i
8/12/2019 Sampling Impr
44/57
A/D "onversion comparator basics
A/D "onversion conversion to logic
8/12/2019 Sampling Impr
45/57
gvalues
A/D "onversion several
8/12/2019 Sampling Impr
46/57
comparators in parallel
A continuous voltage signal iscompared with differentreference voltages and areconverted into either % or 9 %
4hese values are associated withlogic values either 9 or 6
Bit i ti i "
8/12/2019 Sampling Impr
47/57
Bitwise operations in "
AND 6 if both bits are 6( 9 otherwise AND and assignment
P OR 6 if either bits are 6( 9 if they both are 9
P OR and assignment
T XOR 6 if ON, of the bits is 6 and the other is 9
T XORand assignment
U one's complement =lips all bits
KK Shift Left Shifts all bits to the left( inserting 9's
KK Shift Leftand assignment
VV Shift Right Shifts all bits to the right
VV Shift Right and assignment
8/12/2019 Sampling Impr
48/57
Introdu3tion til digitale filtre
8/12/2019 Sampling Impr
49/57
Introdu3tion til digitale filtre
*et us say that we have a sequence of samples
that we wish to process in some way
4ypically( thex'es are used as input to some digital filter
The general formula for a digital filter is
where the a's og b's are filter coefficientesand they's arethe output of the filter at the indicated sample numbers
{x"}"=9,
i=9
naaiy"i=i=9
nbbix "i
Introduction to digital filters
8/12/2019 Sampling Impr
50/57
Introduction to digital filters
>ritten out and rearranged2
naand n
bare usually small integersC furthermore( it it is common
to scale such that a9 6$ b
9is often &but not always+ 9$
=or eJample( a so1called second order filter2
y "=b6x"6+bEx"Ea6y "6aEy "E
a9y"=b9x"+b6x"6++b/x"nba6y"6ana y "na
Simple filters without dynamics
8/12/2019 Sampling Impr
51/57
Simple filters without dynamics
0nit gain
Simple gain
Signal offset
y"=0x "
y "=x"c
y "=x"
4ime delay and difference
8/12/2019 Sampling Impr
52/57
4ime delay and difference
4ime delay
Simple difference filter corresponds to di%%erentiation
y "=x"x"6
y "=x"6
Averaging filters
8/12/2019 Sampling Impr
53/57
Averaging filters
Second order averaging filter
4hird order averaging filter
"entral difference filter
y "=6