Top Banner
ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah ي ڻ رسا ع مد ح ا سان ح ا
32

ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

Mar 26, 2015

Download

Documents

Angel Blake
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

ANALOG TO DIGITAL CONVERSION

Lecture 3,4Syed M. Zafi S. Shah

احسان احمد عرساڻي

Page 2: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

ANALOG TO DIGITAL CONVERSION• SAMPLING

• SAMPLING THEOREM, ALIASING

• QUANTIZATION• QUANTIZATION NOISE

In today’s class

Page 3: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

Need for A/D conversion

We know by now the benefits of digital signals and systems

But most signals of practical interest are still analog Voice, Video RADAR signals Biological signals etc

So in order to utilize those benefits, we need to convert our analog signals into digital

This process is called A/D conversion

Page 4: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

Three step process

Analog to Digital conversion is really a three step process involving

Sampling Conversion from continuous-time, continuous

valued signal to discrete-time, continuous-valued signal

Quantization Conversion from discrete-time, continuous

valued signal to discrete-time, discrete-valued signal

Coding Conversion from a discrete-time, discrete-

valued signal to an efficient digital data format Represent as bit?

Page 5: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

SAMPLING QUANTIZATION

CODING

CT-CV DT-CV DT-DV DT-DV

Analog signal Binary bits

2 4 6 8 10

-1

-0.5

0

0.5

1

2 4 6 8 10

-1

-0.5

0

0.5

1

2 4 6 8 10

-1

-0.5

0

0.5

1

1 2 3 4 5 6 7 8 9 104.5

5

5.5

6

6.5

7

7.5

Arbitrarily, I’ve chosen Differential PCM…. Can you re-create these graphs?

Page 6: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

Sampling

A continuous-time signal has some value ‘defined’ at ‘every’ time instant

So it has infinite number of sample points

2 4 6 8 10

-1

-0.5

0

0.5

1

2 4 6 8 10

-1

-0.5

0

0.5

1

2 4 6 8 10

-1

-0.5

0

0.5

1

2 4 6 8 10

-1

-0.5

0

0.5

1

sampleevery 1 sec

sampleevery 0.1 sec

sampleevery 1 μsec

Page 7: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

It is impossible to digitize an infinite number of points because infinite points would require infinite amount of memory and infinite amount of processing power

So we have to take some finite number of points

Sampling can solve such a problem by taking samples at the fixed time interval

If an analog signal is not appropriately sampled, aliasing will occur, where a discrete-time signal may be a representation (alias) of multiple continuous-time signals

Aliasing:

Page 8: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

Shannon’s sampling theorem

The sampling theorem guarantees that an analogue signal can be in theory perfectly recovered as long as the sampling rate is at least twice as large as the highest-frequency component of the analogue signal to be sampled

max2FFs

A signal with no frequency component above a certain maximum frequency is known asa band-limited signal (in our case we want to have a signal band-limited to ½ Fs)

Some times higher frequency components are added to the analog signal (practical signals are not band-limited)

In order to keep analog signal band-limited, we need a filter, usually a low pass that stops all frequencies above ½ Fs. This is called an ‘Anti-Aliasing’ filter

Page 9: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

In order to sample a voice signal containing frequencies up to 4 KHz, we need a sampling rate of 2*4000 = 8000 samples/second

Similarly for sampling of sound with frequencies up to 20 KHz, we need a sampling frequency of 2*20000 = 40000 samples/second What is the sampling rate for CDs?

Isn’t it more than the one we just calculated?

Page 10: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

Example 1: For the following analog signal, find the Nyquist sampling rate, also determine the digital signal frequency and the digital signalt)70cos(3)( tx

The maximum frequency component is x(t) is

Therefore according to Nyquist, we need a sampling rate of

The digital signal would have a frequency

The digital signal can be represented as

HzF 352

70max

HzFFs 702 max

70

352w

)cos(3][ nnx

Page 11: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

Anti-aliasing filters

Anti-aliasing filters are analog filters as they process the signal before it is sampled. In most cases, they are also low-pass filters unless band-pass sampling techniques are used

The ideal filter has a flat pass-band and the cut-off is very sharp, since the cut-off frequency of this filter is half of that of the sampling frequency, the resulting replicated spectrum of the sampled signal do not overlap each other. Thus no aliasing occurs

Page 12: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

Practical low-pass filters cannot achieve the ideal characteristics. What can be the implications?

Firstly, this would mean that we have to sample the filtered signals at a rate that is higher than the Nyquist rate to compensate for the transition band of the filter

That’s why the sampling rate of a CD is 44.1 KHz, much higher than the 40 KHz we calculated

Go through the assignment… it has some reading task along with some problems

Page 13: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

Example 2: Find the Nyquist’s rate for the following signal t)100cos(-t)300sin(10t)50cos(3)( tx

This composite signal comprises three frequencies

f1 = 25 Hz, f2 = 150 Hz, f3 = 50 Hz

So, according to Nyquist we need to sample at 300 Hz

However, for the ‘sine’ term, the sampled signal has values sin(πn), meaning the samples are taken at the ‘zero crossings’, so the sine term is not counted in the process

Therefore, a solution is to sample at higher than twice the max. freq component

Page 14: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

Quantization

Now that we have converted the continuous-time, continuous-valued signal into a discrete-time, continuous-valued signal, we STILL need to make it discrete valued

This is where Quantization comes into picture

“The process of converting analog voltage with infinite precision to finite precision” For e.g. if a digital processor has a 3-bit word,

the amplitudes of the signal can be segmented into 8 levels

Page 15: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

Quanitization

Page 16: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

General rules for Quantization Important properties

of the quantizer include Number of

quantization levels Quantization

resolution Note the minimum &

maximum amplitude of the input signal Ymin & Ymax

0 1 2 3 4 5 6 7 8 9 10

-1

-0.5

0

0.5

1Ymax = 1

Ymin = -1

Page 17: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

Note the word-length of DSP m-bits

Number of levels of quantizer is equal to L = 2m

The resolution of the quantizer is given as

Resolution of a quantizer is the distance between two successive quantization levels

More quantization levels, better resolution! Whats the downside of more quantization

levels?

)(1

)( minmax voltsL

yy

Page 18: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

0 5 10 15 20 250

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

00

09.0][

n

nnx

n

m = 4, L = 16Ymin = 0Ymax = 1∆ = 1/15 = 0.0667

Page 19: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

Quantization error

The error caused by representing a continuous-valued signal(infinite set) by a finite set of discrete-valued levels

Suppose a quantizer operation given by Q(.) is performed on continuous-valued samples x[n] is given by Q(x[n]), then the quantization error is given by][][][ nxnxne qq

Page 20: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

Lets consider the signal , which is to be quantized.

In the figure (previous slide), we saw that there was a difference between the original signal and the quantized signal. This is the error produced while quantization

It can be reduced, however, if the number of quantization levels is increased as illustrated on next slide

00

09.0][

n

nnx

n

Page 21: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

0 5 10 15 20 250

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

0 5 10 15 20 250

0.02

0.04

0.06

0.08

0.1

0.12

0.14

0 5 10 15 20 250

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

0 5 10 15 20 250

0.5

1

1.5

2

2.5

3

3.5

4x 10

-3

3-bit ADC

8-bit ADC

Quant. error

Quant. error

Page 22: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

Signal-to-Quantization-noise ratio

Provides the ratio of the signal power to the quantization noise (or quanitization error)

Mathematically,

wherePx = ¨Power of the signal ‘x’ (before quantization)Pq = ¨Power of the error signal ‘xq’

q

x

PP

dBSQNR 10log10

1

0

21

0

2 11 N

nq

N

nq nxnx

Nne

NPq

Page 23: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

The sampled signal in the FD

۾ ميدان ڪثرتي سگنل ُج�زايل If

Then

fXtx

nssss nffXffXtx

Page 24: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

The Ideal Sampling Theorem

نظريئڙو ُجmزڪاري خيالي Also called

Uniform Sampling Theorem Nyquist Theorem

If x(t) is band limited with no components at frequencies greater than fh Hz then it is completely specified by samples taken at the uniform rate fs>2fh 2fh is called the Nyquist rate

Page 25: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

The Sampling Rateشرح ُجي uزڪاريَءmُج

The no. of samples per second تعداد �و ُج�زن ۾ سيڪنڊ هڪ

If the sampling rate: fs>2fh , it is called Over-sampling fs=2fh , it is called Critical-sampling fs<2fh , it is called Under-sampling

Page 26: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

اوقاتي mل ڪ ڀڳ Near لڳContinuous

-10 -8 -6 -4 -2 0 2 4 6 8 100

0.5

1

time (seconds)

x(t)

-10 -8 -6 -4 -2 0 2 4 6 8 100

0.5

1

frequency (Hz)

|X(f

)|

Page 27: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

T=0.1

-10 -8 -6 -4 -2 -0.75 0.75 2 4 6 8 10 0

0.5

1

time (seconds)

x(t)

-10 -8 -6 -4 -2 0 2 4 6 8 100

0.5

1

frequency (Hz)

|X(f

)|

Page 28: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

T=?

-10 -8 -6 -4 -2 -0.75 0.75 2 4 6 8 10 0

0.5

1

time (seconds)

x(t)

-10 -8 -6 -4 -2 0 2 4 6 8 100

0.5

1

frequency (Hz)

|X(f)

|

Page 29: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

T=?

-10 -8 -6 -4 -2 0 2 4 6 8 100

0.5

1

time (seconds)

x(t)

-10 -8 -6 -4 -2 0 2 4 6 8 100

0.5

1

frequency (Hz)

|X(f

)|

Page 30: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

Anti-aliasing filters

Anti-aliasing filters are analog filters as they process the signal before it is sampled. In most cases, they are also low-pass filters unless band-pass sampling techniques are used

The ideal filter has a flat pass-band and the cut-off is very sharp, since the cut-off frequency of this filter is half of that of the sampling frequency, the resulting replicated spectrum of the sampled signal do not overlap each other. Thus no aliasing occurs

Page 31: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

Practical low-pass filters cannot achieve the ideal characteristics. What can be the implications?

Firstly, this would mean that we have to sample the filtered signals at a rate that is higher than the Nyquist rate to compensate for the transition band of the filter

That’s why the sampling rate of a CD is 44.1 KHz, much higher than the 40 KHz we calculated

Go through the assignment… it has some reading task along with some problems

Page 32: ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي

Example 2: Find the Nyquist’s rate for the following signal t)100cos(-t)300sin(10t)50cos(3)( tx

This composite signal comprises three frequencies

f1 = 25 Hz, f2 = 150 Hz, f3 = 50 Hz

So, according to Nyquist we need to sample at 300 Hz

However, for the ‘sine’ term, the sampled signal has values sin(πn), meaning the samples are taken at the ‘zero crossings’, so the sine term is not counted in the process

Therefore, a solution is to sample at higher than twice the max. freq component