ekt430/4 digital signal processing 2007/2008 chapter 4 sampling

46
EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

Upload: gerald-hines

Post on 17-Jan-2018

228 views

Category:

Documents


0 download

DESCRIPTION

3 DISCRETE SIGNALS: Why ADC…  Most real world signals are Analog. but  Digital processing of signals need them in digital format.  This requires Interfacing of analog input signal and Discrete to Digital conversion.

TRANSCRIPT

Page 1: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

EKT430/4DIGITAL SIGNAL

PROCESSING2007/2008

CHAPTER 4SAMPLING

Page 2: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

2

OBJECTIVE:

After studying this lecture, you should learn to

explore: Relationship between Word length and

Quantization error, Meaning of specifications for various terms

of ADC and DAC, Sampling frequencies and its

consequences. Concept of digital frequency.

Page 3: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

3

DISCRETE SIGNALS:Why ADC…

Most real world signals are Analog. but Digital processing of signals need them in

digital format.

This requires Interfacing of analog input signal and Discrete to Digital conversion.

Page 4: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

4

Sample and Hold

A time-signal, when passes through a sec wide time window, it is sampled.

If the window appears periodically after every T seconds, the signal is a train of discrete-time pulses of sec width & appears after every T sec.

Its duty cycle is thus /T. The peak level of the sampled signal is

retained by a sample and hold (S/H) circuit. The hold time should be greater than the

conversion time of ADC.

brijmohan singhi
Page 5: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

5

Aperture time

The minimum time for which the sampling switch should remain open is

Tap= 1/[2Bmax]

For 16bit conversion of 20 kHz signal, the required aperture time is:

Tap=1/[216x 2x20x203] seconds. = 0.121 nsec.

Page 6: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

6

Hold

The information is saved in a temporary register; the register is a capacitor of a sample and hold (S/H) circuit.

Such hold circuit is named a zero order hold (ZOH).

One can choose a first order hold (FOH) also.

The ZOH selects peak level, while the FOH uses trapezoid integration mode.

Page 7: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

7

Discrete to Digital

The output of the hold circuit, has to take a value among a predefined set of levels, termed as a digitalization of the signal.

This process is called quantization.

The number of levels in the set are 2n where n is the word length.

The common range of N lies between 8 to 14.

Page 8: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

8

N-bit Uniform QuantizationContinuous input signal digitized into 2N levels.

Quantisation stepQuantisation step A =D/ L where L = 2N

Ex: D = 1V , N = 12

A = 244.1 V

LSBLSB

Voltag%e ( = A)

Scale factor (= 1/L=1 / 2N )

Percentage (= 100 / 2N )

Quantisation errorQuantisation error

-4

-3

-2

-1

0

1

2

3

-4 -3 -2 -1 0 1 2 3 4

000

001

111

010

V

VFSR

-1

-0.5

0

0.5

1

-4 -3 -2 -1 0 1 2 3 4

- A / 2

A/ 2

Page 9: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

9

Quantization of a Rampwith eight quantization levels

Number of quantization levels: n 8

i 0 40 xi 1 0.1 i y quantize x n( )

0 10 20 30 400.5

1.5

2.5

3.5

4.5

5.5

xi

yi

i

Step=0.75V

Page 10: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

10

Quantization of Sinusoidalwith eight quantization levelsNumber of quantization levels: n 8

i 0 200 ai sin2 i

50A quantize a n( )

0 50 100 150 2001

0

1

ai

Ai

i

Page 11: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

11

Quantization Error is caused when a signal is discretized to a finite word length.

Let D be the dynamic range; L, the number of levels; Then the resolution or, step size is A=D/L. Since there is equal opportunity for any level to

occur, we take uniform probability distribution [, ] represented by a pulse having height = 1/A and width lies in the step size range [-A/2,A/2]. Note that the area under the probability curve is unity.

Page 12: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

12

Quantization Error…The variance 2 = noise power PN and

Thus Noise power ; PN = A2/12 = D2/12 L2

Or, 10 log (PN) = 20 log D – 20 log L – 10.8 dB

*For Tone frequency, it comes to 6.02dB+1.76 dB

pN1A A

2

A2

2dpNA2

A2

2 P d

P= 1/A

Page 13: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

13

(S/N) dB

Letting Ps be the signal power. If B=word length; L = 2B. (S/N) dB = 10 Log (Ps) -20 log D + 20 log (2B) + 10.8

dB = 10 Log (Ps) + 6.02B + 10.8 - 20 log D dB. Thus For a given dynamic range and input signal power, (S/N)dB increases @ 6.02 dB per bit increase in word

length.

Page 14: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

14

Example:A sampled signal that varies between - 2V to +2V is

quantized using B bits. What value of B will ensure an rms quantization error of less than 5mV?

Solution: The noise power fed into 1 ohm resistance is given by the

square of the variance, 2=(D/L)2/12. Here D is the dynamic range of the signal and L is the number of steps in quantization given by 2B where B is the bit length.

Problem specifies D = 4 V, = 0.005 V. Use the formulae to calculate B:

= (D/L)/√12 = (D/2B)/ √12; B is calculated to be 7.85 8.

Page 15: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

15

A typical ADC

Configuration control i/p

Configuration circuitry

ADC Circuit

Output Interface

Control circuitry

Multichannel analog i/p

Control inputs

power

Digital output

Output status

Page 16: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

16

ADC

Configuration Circuitry permits to configure output in either Unipolar, Bipolar or 2’s complement format, to suit applications.

Control circuitry permits control of input channel, leveling of the analog input, control of sample and hold circuit, buffering the output, and to transfer it in serial or, parallel format etc.

Output controls flag of conversion, transfer of data.

Page 17: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

17

Mathematical model of DAC b’s represent presence or, absence of different binary

numbers. Xu = [b12-1+ b22-2+………+ bb2-b]; b’s are either 0 or 1. Maximum value being [1 – 2-b],

for four bits, output ranges between: 0 – 0.9375 Xb = [b12-1+ b22-2+………+ bb2-b - 5]; Note: the first bit is sign bit, 1 being positive.

for four bits, output ranges between -0.5 : + 0.4375 Xc = [bc

1 2-1 + b22-2 +……+ bb2-b – 0.5].

Note: in 2’s complement expression of Xc,, the code for

the first number is complemented and 1 is added. It is equivalent to binary polar with off-set coding and sign bit complemented]

Page 18: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

18

Table of different coding Table : Converter codes for B = 4 bits, and input 10 volts.

b1b2b3b4

natural binary offset binary 2's Cm XQ =Qm m' XQ =Qm' b1b2b3b4

-- 16 10.000 8 5.000 --1111 15 9.375 7 4.375 01111110 14 8.750 6 3.750 01101101 13 8.125 5 3.125 01011100 12 7.500 4 2.500 01001011 11 6.875 3 1.875 00111010 10 6.250 2 1.250 00101001 9 5.625 1 0.625 00011000 8 5.000 0 0.000 00000111 7 4.375 -1 -0.625 11110110 6 3.750 -2 -1.250 11100101 5 3.125 -3 -1.875 11010100 4 2.500 -4 -2.500 11000011 3 1.875 -5 -3.125 10110010 2 1.250 -6 -3.750 10100001 1 0.625 -7 -4.375 10010000 0 0.000 -8 -5.000 1000

Page 19: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

19

Different types of ADCs random Generally: Suitable for any signal

i) Flash: Instant: susceptible to errors ii) Single slope Method: noise prone iii) Dual slope Method: slow, accurate iv) Successive Approximation: Fastest, best.

For continuous signals with time-slope in known limits.

i) Delta Modulation ADC ii) Adaptive Delta Modulation ADC iii) Sigma Delta Modulation ADC etc.

Page 20: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

20

DAC

A word-length of pulses are passed through a weighted resistance network.

The output waveform looks like a staircase.

This waveform is passed through a low pass filter for smoothening.

The low pass filter (LPF) should have linear phase characteristic.

An ideal zero order hold (ZOH) is a suitable LPF.

Page 21: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

21

Zero-Hold Circuit: a low pass filter

h t( ) 1 0 t Tif

0 otherwise

F f( )T sin 2 f T

2

2 f T2

4 3 2 1 0 1 2 3 40.5

0.25

0

0.25

0.5

0.75

1

F f( )

f

The transfer function h(t) of a hold circuit is: Note linear phase-frequency characteristic.

H ( ) Tsin T

2

T2

e

jT2

Page 22: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

22

Effect of Change of duty cycle of a pulse on frequency response:Note: product of height and first zero crossing of frequency is unity

T 1 f 4 3.9 4 F f( )T sin 2 f T

2

2 f T2

4 3 2 1 0 1 2 3 40.5

0.25

0

0.25

0.5

0.75

1

F f( )

f

T 2 f 4 3.9 4 F f( )T sin 2 f T

2

2 f T2

4 3 2 1 0 1 2 3 41

0.5

0

0.5

1

1.5

2

F f( )

f

Page 23: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

23

Schematic of DAC

Configuration Circuitry

D/A Conversion Circuitry

Input Interface

Control Circuitry

Analogue Output

Power Supply

Control Inputs

Digital Inputs

Configuration Inputs

Page 24: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

24

Mathematical Models of DAC

An DAC can be:

Unipolar Natural Binary

Bipolar off-set binary

Two’s complement.

The word length: b-bits, MSB to LSB.

DAC

Analog output

R (reference)

LSB

MSB

B input bits

b1

b2

b3

bB

XQ

Page 25: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

25

ALIASING

Dictionary meaning: False presentation. For faithful recovery of the modulating

signal, carrier frequency 2.bandwidth of interest. It is called Nyquist Criteria-1. It is also applicable to sampling. Sampling is SC-AM. Here we multiply a train of pulses with

signal.The train of pulses here is carrier-wave.

Page 26: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

26

What is Aliasing? According to the Fourier Transform, a time

domain impulse train having time period of Ts seconds, results into a frequency train at frequency difference of fs = 1/Ts.

When a signal having a frequency fa is sampled by an impulse train spaced at Ts= 1/fs, translates the spectra in frequency domain around every integer multiple of fs represented by

[(nfs-fa) – (nfs+fa)].

Page 27: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

27

What is Aliasing?

If fs /2 < fa , the spread of spectra alias that is interlace with each other.

It prohibits signal’s reconstruction. To illustrate, we take a band of

frequencies between 0 to fa. In the Nyquist range, aliases can be at (f Nfs).

Take values of N Such that these frequencies lie in the range fs/2.

Page 28: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

28

Sampling Base-band signals

-B 0 B f

Continuous spectrum (a) Base band signal: (fMAX = B).

(a)

-B 0 B fS/2 f

Discrete spectrum No aliasing (b) Time sampling frequency

repetition.

fS > 2 B no aliasing.

(b)

0 fS/2 f

Discrete spectrum Aliasing & corruption (c)

(c) fS 2 B aliasing !aliasing !

Aliasing: signal Aliasing: signal ambiguity in frequency ambiguity in frequency domaindomain

Page 29: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

29

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 spectra can aliase into band of interest. Filter it Filter it

before!before!

(a)

(b)

-B 0 B f

Antialiasing fi lter Passband

f requency

(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, stop-band frequency...

(c) Antialiasing Antialiasing filterfilter

Page 30: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

30

Under-sampling ??

mBCf2

Sf1mBCf2

m is selected so that fS > 2B

B

0 fC f

Bandpass signal centered on f C

-fS 0 fS 2fS f fC

AdvantagesAdvantages Slower ADCs / electronics Slower ADCs / electronics

needed.needed.

Simpler antialiasing filters.Simpler antialiasing filters.

fC = 20 MHz, B = 5MHz

a. Without under-sampling fS > 40 MHz.

b. With under-sampling?? fS = 22.5 MHz (m=1);

= 17.5 MHz (m=2); = 11.66 MHz (m=3).

c.

ExamplExamplee

Nyquist theorem: Maximum frequency of interest?Maximum Bandwidth of interest?

Or, in the spirit of Nyquist

For base-band, both are same.

Shift band pass signal to base-band signal

Page 31: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

31

Over-sampling: improves quantisation signal to noise ratio

One bit equivalent quantisation SNR is One bit equivalent quantisation SNR is improved on each quadruple over-improved on each quadruple over-

sampling. sampling. This trade off is efficiently used in noise-shaping.

The unutilized signal power dispersed due to quantization, is absorbed and thus utilized by the frequency spectra created due to over-sampling. for details refer (a) Orfanidis, ‘Introductin to signal processing’ PHI, pp.67-71’

(b) Ambarder,’Analog & Digital signal processing’ 2/e, pp463-465.

Page 32: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

32

Let us take a problem on aliasing..

A 100 Hz sinusoidal is sampled at rates of (a) 240Hz, (b) 140 Hz, (c) 90 Hz and (d) 35 Hz. Workout each case for aliasing signals?

Solution The signal is: xa (t) = cos(2f t ) ; f=100 is the

signal frequency, fs is the sampling frequency and N is an integer. New spectra of frequencies in the Nyquist range decided by the sampling frequency is calculated using the formulae (f Nfs). Hence:

(a) f = 240 Hz > 200 Hz, calls for absence of aliasing. (b) For f =140 Hz, aliased frequency component is: fa=(100 –140) = -40 Hz. The aliased Signal is: xa(t) = cos(-80t ) = cos(80t -).

Page 33: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

33

(c) When fs = 90 Hz, fa = (100-90) Hz = 10 Hz. The aliased Signal is: xa(t)=cos(20t ),

(d) When fs = 35 Hz, fad= (100 – thrice 35) Hz = -5 Hz. Thrice is taken so that the alias is in principal frequency range. The aliased signal is :

xa(t) = cos(-10t ) = cos(10t - ).

Note the phase change in (b) and (d) above.

Page 34: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

34

Yet another example on aliasing....

Given x(t) = 4 + 3cos(t)+2cos (2t)+cos (3t),t is in msec. Determine the recovered signal xa(t) if the signal is sampled at half its Nyquist rate.

Maximum signal frequency is 1.5 kHz. Hence the Nyquist rate is 2x1.5 = 3 kHz. The signal x(t) is sampled at half the Nyquist rate i.e. at 1.5 kHz. The range of output frequencies lie within-0.75 kHz ≤ f ≤ 0.75kHz.

Result: xa(t) = 5 + 5cos (t) and the waveforms:

Page 35: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

35

Waveform :

x t( ) 4 3 cos t( ) 2 cos 2 t( ) cos 3 t( )

0 5 100

5

10

x t( )

5 5 cos t( )

t

Page 36: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

36

Yet another problem… The above signal can be rewritten as: x(t) = 3sin (t) + 2sin (5t) = x1(t) + x2(t). X1(t), since lies in the Nyquist range

-0.5fs≤ f ≤ 0.5fs,, will not alias. However x2(t), since lie out side the Nyquist range, alias. The resulting frequency will be [5t- 6t= -t]. The output is xa (t)=3sin (t)+2sin (-t)= sin

(t). Resulting waveforms in next slide

Page 37: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

37

The waveform of DSP02_04_G

x t( ) sin t( ) 4 sin 3 t( ) cos 2 t( )

0 1 2 3 4 55

3

1

1

3

5

x t( )

sin t( )

t

Page 38: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

38

summary:1. DSP involves time and amplitude quantization.

2. Time quantization: To avoid aliasing, the sampling frequency fs should be twice the maximum signal Bandwidth of interest.

3. We can as well increase fs. Higher fs implies more sampled data more processing time more storage space. Value of fs is decided by the maximum signal bandwidth of interest. This highest filterable frequency is decided from the spectra of the signal.

4. It is a source of error.

Page 39: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

39

summary:

5. Anti-aliasing (pre) filtering truncates the signal by removing the rejectable frequency component of the signal.

6. ADC is used for level quantization (digitalization). Higher word-length, n, too will require more processing time and more storage space.

7. “Time sampled and amplitude quantized” data is processed in DSP.

8. Output of DSP may be converted back in analog form using DAC followed by post-filtering. It uses analog electronics.

Page 40: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

40

Anti-aliasing Filter

It is also called a pre-filter, a post-filter is employed after DAC, if used.

It is an analog filter. It can be a low-pass or, band pass one with

linear phase characteristics. Error is caused due to spectra truncation of

the signal. The brick-wall characteristic is ideal, but not

practically realizable. The low-pass filters can be complex.

Page 41: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

41

Defining digital frequency

Digital frequency, FD, is a concept. It is normalization of frequencies. Use of it reduces calculations. It is a ratio of signal frequency to

sampling frequency: FD = f/fs.

Units are cycles/sample. fs is samples per second.

Page 42: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

42

Defining digital frequency

|FD| ≤ 0.5 is the newly defined Nyquist range, here the signal is completely recoverable.

An input signal can be sampled at some frequency fs1 and reconstructed at other frequency say fs2. The frequency of the recovered signal will be multiplied by the factor: (fs2/fs1) provided that Nyquist range is maintained...

Page 43: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

43

Exampleillustrate frequency scaling due to different samplingrate at recovery....A 100 Hz sinusoidal (fx) is sampled at S Hz. Thesampled signal is then reconstructed at 540 Hz. What is the frequency of the reconstructed signal fr,if (i) S = 270 Hz (ii) 70 Hz.(a) For S1 = 270 Hz, the digital frequency of the

sampled signal is FD = 100/270. It lies in the principal period.

The frequency of reconstruction fr is: fr = (S2/S1) x fx = (540/270)x100 = 200Hz.

Page 44: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

44

(b) If S = 70 Hz, the FD = 100/70. It lies outside the principal range. It is a case of alias. The alias freq. : fa = (100-70) = 30 Hz and

(100-2X70)= -40 Hz. The second case is outside the principal period of 35 Hz, hence not considered. The reconstructed aliased frequency is 30x 540/70.

Page 45: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

45

Simplification of anti-alias filters

To avoid the aliasing while the sample frequency is low, requires a high order low pass filter.

Examples are Butterworth and Tchebyshev filters type 1,2 and 3. Some of these Tchebyshev filters have pass band ripple and can be a source of error.

Such filters use low drift operational amplifiers and precise R, C elements.

These filters are bulky, costly and difficult to tune. Linear phase together with high magnitude

attenuation characteristic is impossible to implement. Hence we use alternative technique….

Page 46: EKT430/4 DIGITAL SIGNAL PROCESSING 2007/2008 CHAPTER 4 SAMPLING

46

Continued…alternatively… Use of a simple Low Pass analog filter, sample @ many times, say X4, the Nyquist rate. A high attenuation linear phase digital filter is used. Decimation process is now applied. Here three samples are skipped and one sample out of every 4 is taken. Compensation, if needed, is also digitally

provided. At the output, fill in the three skips using

interpolation and use a DAC followed by a simple low pass analog filter.

Isn’t technically excellent and robust scheme ?