digital signal processing sampling

Upload: syazo93

Post on 04-Nov-2015

46 views

Category:

Documents


7 download

DESCRIPTION

DIGITAL SIGNAL SAMPLING PROCESS

TRANSCRIPT

  • ECE3123 Digital Signal Processing

    Session-II Sampling

    Prof. Dr. Othman O. KhalifaKhairul Azami Sidek

    Electrical and Computer EngineeringKulliyyah of Engineering

    International Islamic University Malaysia

  • Transducer Anti-Alaising FilterAmplifierAnalog

    Multiplexor Sample & Hold

    Program Sequencer

    Quantizer

    Coder

    A/D Converter

    Digital Output Signal

    Analog Input Signal

    uPControl

    Additional Analog Signals

    Analog Output Signal

    D/A ConverterData Recovery FilterAmplifier

    Remember : Data Acquisition and Recovery System

  • Definitions Data acquisition is the process by which physical

    phenomena from the real world are transformed into electrical signals that are measured and converted into a digital format for processing, analysis, and storage by a computer.

    Data acquisition (DAQ) system is designed not only to acquire data, but to act on it as well.

    A data acquisition system consists of many components that are integrated to:

    Sense physical variables (use of transducers) Condition the electrical signal to make it readable by

    an A/D board Convert the signal into a digital format acceptable by

    a computer Process, analyze, store, and display the acquired data

    with the help of software

  • Definitions : Transducers,sensors and Actuators Transducer: A device which transforms energy

    from one domain (magnetic, thermal, mechanical, optical, chemical, electrical) into another

    Sensors: devices which monitor a parameter of a system, hopefully without disturbing that parameter.

    Actuators: devices which impose a state on a system, hopefully independent of the load applied to them

  • Elements of a data acquisition system Transducers (Sensors, Actuators) wiring Signal conditioning Data acquisition hardware PC (operating system) Data acquisition software

  • Human sensing and organs Vision: eyes (optics, light) Hearing: ears (acoustics, sound) Touch: skin (mechanics, heat) Odor: nose (vapor-phase chemistry) Taste: tongue (liquid-phase

    chemistry)

  • TransducersSense physical phenomena and

    translate it into electric signal.

    Displacement

    Level

    Electric signals

    ON/OFF switch

    Temperature

    Pressure

    Light

    Force

  • Transducers

    A transducer is a device that converts energy from one form to another.

    In signal processing applications, the purpose of energy conversion is to transfer information, not to transform energy.

    In physiological measurement systems, transducers may be input transducers (or sensors)

    they convert a non-electrical energy into an electrical signal. for example, a microphone.

    output transducers (or actuators) they convert an electrical signal into a non-electrical energy. For example, a speaker.

  • Sensors and Actuators Example of sensors

    Magnetic sensors Honeywells HMC/HMR magnetometers

    Photo sensors Clairex: CL9P4L

    Temperature sensors Panasonic ERT-J1VR103J

    Accelerometers Analog Devices: ADXL202JE

    Motion sensors Advantacas MIR sensors

    "Without disturbing that parameter" implies that the sensors must be small and low-power devices in order to reduce energy exchange.

    Sensors: devices which monitor a parameter of a system, hopefully without disturbing that parameter.

  • Sampling The process of converting a continuous-time signal to

    a sequence of numbers is called Sampling In general, ADC consists of four steps to digitize an

    analog signal:1. Filtering2. Sampling3. Quantization4. Binary encoding

    Before we sample, we have to filter the signal to limit the maximum frequency of the signal as it affects the sampling rate.

    Filtering should ensure that we do not distort the signal, ie remove high frequency components that affect the signal shape

  • Basic ADC

  • Analog signal is sampled every TS secs. Ts is referred to as the sampling interval. fs = 1/Ts is called the sampling rate or

    sampling frequency. There are 3 sampling methods:

    Ideal - an impulse at each sampling instant Natural - a pulse of short width with varying

    amplitude Flattop - sample and hold, like natural but with

    single amplitude value The process is referred to as pulse amplitude

    modulation PAM and the outcome is a signal with analog (non integer) values

    Sampling

  • Remember . Signal TypesAnalog signals: continuous in time and amplitude

    Example: voltage, current, temperature,Digital signals: discrete both in time and amplitude

    Example: attendance of this class, digitizesanalog signals,

    Discrete-time signal: discrete in time, continuous inamplitude

    Example: e.g. hourly change of temperatureIn practice we mostly process digital signals onprocessors

    Need to take into account finite precision effects

  • Periodic (Uniform) Sampling Sampling is a continuous to discrete-time conversion

    Most common sampling is periodic

    T is the sampling period in second fs = 1/T is the sampling frequency in Hz Sampling frequency in radian-per-second s=2pipipipifs rad/sec Use [.] for discrete-time and (.) for continuous time signals This is the ideal case not the practical but close enough

    In practice it is implement with an analog-to-digital converters We get digital signals that are quantized in amplitude and time

    [ ] ( )

  • Periodic Sampling Sampling is, in general, not reversible Given a sampled signal one could fit infinite continuous signals

    through the samples

    0-1

    20 40 60 80 100

    -0.5

    0

    0.5

    1

    Fundamental issue in digital signal processing If we loose information during sampling we cannot

    recover it Under certain conditions an analog signal can be sampled

    without loss so that it can be reconstructed perfectly

  • Representation of Sampling

    Mathematically convenient to represent in two stages Impulse train modulator Conversion of impulse train to a sequence

    Convert impulse train

    to discrete-time sequence

    xc(t) x[n]=xc(nT)x

    s(t)

    -3T-2T 2T3T4T-T T0

    s(t)xc(t)

    t

    x[n]

    -3 -2 2 3 4-1 10n

  • ADC is an acronym for Analog to Digital Converter whichconverts the analog signal x(t) into the digital signalsequence x(n). Analog-to-digital conversion ordigitization consists of the sampling and quantizationprocesses. The sampling process depicts acontinuously varying analog signal as a sequence ofvalues. The quantization process approximates awaveform by assigning an actual number for eachsample. An ADC consists of two fundamental blocks;an ideal sampler and a quantizer.

    Analog to Digital Conversion

    x(t)Ideal Sampler

    x(nT)Quantizer

    x(n)

    A/D converter

  • Analog-to-digital conversion carries out the following steps: 1. The bandlimited signal x(t) is sampled at uniformly spaced

    instants of time , nT, where n is a positive integer, and T is the sampling period in seconds. This sampling process converts an analog signal into a discrete-time signal, x(nT), with continuous amplitude value.

    2. The amplitude of each discrete-time sample is quantized into one of the 2B levels, where B is the number of bits the ADC has to represent for each sample. The discrete amplitude levels are represented (or encoded) into distinct binary words x(n) with a fixed wordlength B. This binary sequence, x(n), is the digital signal for DSP hardware.

    Analog to Digital Conversion

  • Sampling Process Use A-to-D converters to turn x(t) into numbers

    x[n] Take a sample every sampling period Ts uniform

    sampling Continuous-time to

    Discrete-timex(t) x[n] x[n]=x(nTs)

    f=100 Hz

    fs=2 kHz

    fs=500 Hz

  • Sampling Theorem Bridge between continuous-time and discrete-time Tell us HOW OFTEN WE MUST SAMPLE in order not to loose any

    information

    For example, the sinewave on previous slide is 100 Hz. We need to sample this at higher than 200 Hz (i.e. 200 samples per second) in order NOT to loose any data, i.e. to be able to reconstruct the 100 Hz sinewave exactly.

    fmax refers to the maximum frequency component in the signal that has significant energy.

    Consequence of violating sampling theorem is corruption of the signal in digital form.

    Sampling TheoremA continuous-time signal x(t) with frequencies no higher than fmax (Hz) can be reconstructed EXACTLY from its samples x[n] = x(nTs), if the samples are taken at a rate fs = 1/Ts that is greater than 2fmax.

  • Whose theorem is this ? The sampling theorem is usually known as the Shannon

    Sampling Theorem due to Claude E. Shannons paper A mathematical theory of communciation in 1948. The minimum required sampling rate fs (i.e. 2xB) is known as the Nyquist sampling rate or Nyquist frequency because of H. Nyquists work on telegraph transmission in 1924 with K. Kpfmller.

    The first formulation of the sampling theorem precisely and applied it to communication is probably a Russian scientist by the name of V. A. Kotelnikov in 1933.

    However, mathematician already knew about this in a different form and called this the interpolation formula. E. T. Whittaker published the paper On the functions which are represented by the expansions of the interpolation theory back in 1915!

  • Whose theorem is this ?...The discovery of the sampling theorem is attributed to Harry Nyquist and Claude Shannon. In 1928, Nyquist referenced the existence of the theorem in his paper, "Certain Topics in Telegraph Transmission Theory," but he did not explicitly explore it. It remains a mystery why Nyquist is considered one of the founders of the principal, except for the fact that the company he worked for--Bell Labs--referred to the concept as the Nyquist Sampling Theorem in their texts. In 1949, credit for the theorem was also given to Shannon, a mathematical engineer, based on the results outlined in his published work, "Communication in the Presence of Noise." This altered the official name to the Nyquist-Shannon Sampling Theorem. This stick even though other scientists--including E. T. Whittaker and V. A. Kotelnikov--had published similar findings in 1915 and 1933 respectively.

  • Sampling An ideal sampler can be considered as a switch that is, it

    is periodically open and closed every T seconds which is expressed as:

    where fs is the sampling frequency (or sampling rate) in hertz (Hz, or cycles per second).

    )()(][ nTxtxnx anTta == =

    xa(t) x[n]

  • Sampling In order to represent an analog signal x(t) by a

    discrete-time signal x(nT) accurately, the following conditions must be met:

    1. The analog signal, x(t), must be bandlimited by the bandwidth of the signal fM

    2. The sampling frequency, fs, must be at least twice the maximum frequency component fM in the analog signal x(t). That is,

    Shannons sampling theorem

  • Sampling Shannons Sampling Theorem: This states that when

    the sampling frequency is greater than twice the highest frequency component contained in the analog signal, the original signal x(t) can be perfectly reconstructed from the discrete signal x(nT).

    The minimum sampling frequency fs=2fM is the Nyquist rate while fN= fs / 2 is the Nyquist frequency (or folding frequency). The frequency interval [fs / 2, fs / 2] is called the Nyquist interval.

    When an analog signal is sampled at sampling frequency, fs, frequency components higher than fs / 2 fold back into the sampling range [0, fs / 2]. This undesired effect is known as aliasing. An anti-aliasing filter is an analog lowpass filter with the cut-off frequency of

  • Sampling The intermediate signal, x(nT), is a discrete-time

    signal with a continuous value (a number has infiniteprecision) at discrete time nT, n = 0, 1, , asillustrated in the figure below. The signal x(nT) is animpulse train with values equal to the amplitude of x(t)at time nT. The analog input signal x(t) is continuous inboth time and amplitude while the sampled signal x(nT)is continuous in amplitude, but defined only at discretepoints in time. Thus the signal is zero except atsampling instants t = nT.

    0 T 2T 3T 4TTime, t

    x(nT)

  • Sampling proof Therefore, to reconstruct the original signal

    x(t), we can use an ideal lowpass filter on the sampled spectrum:

    This is only possible if the shaded parts do not overlap. This means that fs must be more than TWICE that of B.

  • What happens if we sample too slowly? What are the effects of sampling a signal at,

    above, and below the Nyquist rate? Consider a signal bandlimited to 5Hz:

    Sampling at Nyquist rate of 10Hz give:

  • What happens if we sample too slowly?

    Sampling at higher than Nyquist rate at 20Hz makes reconstruction much easier.

    Sampling below Nyquist rate at 5Hz corrupts the signal.

    ALIASING

  • Anti-aliasing filter

    Anti-aliasing filter To prevent aliasing effect A low-pass analog filter with cut-off

    frequency less than half of sampling frequency

    Pre-filtering to ensure all frequency components outside band-limited signal sufficiently attenuated

  • Anti-aliasing filter ,,,, To avoid corruption of signal after sampling, one must ensure that

    the signal being sampled at fs is bandlimited to a frequency B, where B < fs/2.

    Consider this signal spectrum:

    After sampling:

    After reconstruction:

  • Nyquist Sampling & Aliasing Given a sequence

    of number representing a sinusoidal signal, the original waveform of the signal (continuous-time signal) cannot be determined

    Ambiguity caused by spectral replicating effect of sampling

  • Practical Sampling Impulse train is not a very practical sampling

    signal. Let us consider a train of pulses pT(t) of pulse width t=0.025 sec.

    *

  • Ideal Signal Reconstruction Use ideal lowpass filter:

    Thats why the sinc function is also known as the interpolation function:

  • Practical Signal Reconstruction

    Ideal reconstruction system is therefore:

    In practice, we normally sample at higher frequency than Nyquist rate:

  • Example of sample and hold

  • Signal Reconstruction

    First, the digitallyprocessed data y(n)are converted to theideal impulse trainys(t), in which eachimpulse has itsamplitudeproportional to digitaloutput y(n), and twoconsecutive impulsesare separated by asampling period of T;

    second, the analogreconstruction filter isapplied to the ideallyrecovered sampledsignal ys(t) to obtainthe recovered analogsignal.

  • Signal Reconstruction

  • Signal Reconstruction

    Perfect reconstruction is not possible, even if we use ideal low pass filter.

    Aliasing

  • Limits of Human Hearing

    20 Hz. < Human Hearing < 20 KHz.

    Loudness is PERCEPTION related to POWER, not AMPLITUDE

    20 Hz. < Human Hearing < 20 KHz.

    Loudness is PERCEPTION related to POWER, not AMPLITUDE

  • terminology: sampling frequency/rate fs Nyquist frequency fs/2 sampling interval/period Ts

    e.g. CD audio: fmax 20 kHz ) fs = 44,1 kHz

    Sampling as a summary

    anti-aliasing prefilters: if then frequencies above the Nyquist frequency will be

    folded back to lower frequencies= aliasing

    to avoid aliasing, the sampling operation is usually preceded by a low-pass anti-aliasing filter

    . oversampling:it is possible to make a trade-off between sampling rate and quantization noiseusing a coarse quantizer may be compensated by sampling at a higher rate = oversampling

  • Example 1 :If the analog signal is in the form of :

    xa[t] = 3cos(1000t-0.1)- 2cos(1500t+0.6) + 5cos(2500t+0.2)

    Determine the signal bandwidth and how fast to sample the signal without losing data ?

  • Solution :1. There are 3 frequencies components in the signal which is w1 = 1000, w2 = 1500, w3 = 25002. The Input frequencies are :

    F1 = w1 / 2 = 500 Hz, F2 = w2 / 2 = 750 Hz, F3 = w3 / 2 =1250 Hz 3. Thus the Bandwidth Input signal is :

    fmax = 1250 Hz or 1.25 kHz4. Thus the signal should be sampled at

    frequency more than twice the Bandwidth Input Frequency,

    F T > 2 fmThus the signal should be sampled at 2.5 kHzin order to not lose the data. In other words, we need more than 2500 samples per seconds in order to not lose the data

  • Example 2 :The input continuous signal which have frequency of 2kHz enter the DTS system and being sampled at every 0.1ms. Calculate the digital and normalized frequency of the signal in Hz and rad.

  • Solution :1. Calculate the Sampling Rate :

    FT = 1 / T = 1 / (0.1ms) = 10 kHz.2. Now, calculate the digital frequency.

    f = F / FT = 2 kHz / 10 kHz = 0.23. The digital frequency in radian, = 2f = 2 (0.2) = 0.4 rad.

    4. The normalized digital frequency in radian, = T = 2FT = 2(2kHz)(0.1ms) = 0.4.

  • Example :The analog signal that enters the DTS is in the form of :

    xa[t] = 3cos(50t) + 10sin(300t) - cos(100t)a. Determine the input signal bandwidth.b. Determine the Nyquist rate for the signal.c. Determine the minimum sampling rate required to avoid aliasing.d. Determine the digital (discrete) frequency after being sampled at sampling rate determined from c.e. Determine the discrete signal obtained after DTS.

  • Solutions :a. The frequencies existing in the signals are :

    F1 = w1 / 2 = 50 / 2 = 25 Hz.F2 = w2 / 2 = 300 / 2 = 150 Hz.F3 = w3 / 2 = 100 / 2 = 50 Hz.

    f m = Maximum input frequency = 150 Hz.b. The Nyquist rate is defined as :

    2 f m = f T = 2(150 Hz) = 300 Hz.c. The minimum sampling rate required to avoid aliasing is

    f T 2 f m = 300 Hz.d. f1 = F1 / FT = 25 Hz / 300 Hz = 1/12

    f2 = F2 / FT = 150 Hz / 300 Hz = 1/2f3 = F3 / FT = 50 Hz / 300 Hz = 1/6

    e. The discrete signal after DTS is :x[n] = xa[nTs] = 3cos[2n(1/12)] + 10sin[2n(1/2)]- cos[2n(1/6)]

  • The fundamental distinction between discrete-time signal processing and DSP is the wordlength. The former assumes that discrete-time signals values x(nT)have infinite wordlength while the latter assumes that digital signal values x(n) only have a limited B-bit.

    The quantizing and encoding process is a method of representing the sampled discrete-time signal x(nT) as a binary number that can be processed with DSP hardware. To process or store the discrete-time signal with DSP hardware, the signal must be quantized to a digital signal x(n) with a finite number of bits. If the wordlength of an ADC is B bits, there are 2B different values (levels) that can be used to represent a sample.

    Quantization is therefore a process that represents an analog-valued sample x(nT) with its nearest level that correspnds to the digital signal x(n).

    Quantizing and Encoding

  • Quantizer (Quantization) The real-valued signal has to be stored as a code for

    digital processing. This step is called quantization.])[(][ nxQnx =

  • Sampling results in a series of pulses of varying amplitude values ranging between two limits: a min and a max.

    The amplitude values are infinite between the two limits.

    We need to map the infinite amplitude values onto a finite set of known values.

    This is achieved by dividing the distance between min and max into L levels, each ofheight ....

    = (max - min)/L

    Quantization

  • Quantization

    L: No. of quantization levelm: Number of bits in ADC: Step size of quantizeri: Index corresponding to binary codexq: Quantization levelxmax: Max value of analog signalxmin: Min value of analog signal

    Example:

    Unipolar

  • Assume we have a voltage signal with amplitutes Vmin=-20V and Vmax=+20V.

    We want to use L=8 quantization levels. Zone width

    = (20 - -20)/8 = 5 The 8 zones are: -20 to -15, -15 to -10, -10

    to -5, -5 to 0, 0 to +5, +5 to +10, +10 to +15, +15 to +20

    The midpoints are: -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5

    Quantization levels

  • Quantization contd.

    Bipolar

  • Example 4

    Problem:

    Solution:

    a.

    b.

    c.

    101d.Quantization error:

  • QuantizationQuantization Introduces Noise

    Quantization Introduces Noise

  • Analysis of quantization errors

    Quantization error In general, for a quantizer with step size , the

    quantization error satisfies that

    when

    If x[n] is outside this range, then the quantization error is larger in magnitude than /2, and such samples are saided to be clipped.

    ][][][ nxnxne =

    2/][2/

  • Analysis of quantization errors

    Analyzing the quantization by introducing an error source and linearizing the system:

    The model is equivalent to quantizer if we know e[n].

  • Example of quantization error

    original signal

    3-bit quantization result

    3-bit quantization error

  • Example of quantization error

    8-bit quantization error

    In a heuristic sense, the assumptions of the statistical model appear to be valid if the signal is sufficiently complex and the quantization steps are sufficiently small, so that the amplitude of the signal is likely to traverse many quantization steps from sample to sample.

  • Quantization Noise

  • DT Signals: Quantization Error Computation

  • DT Signals: Quantization Error Computation

  • DT Signals: Quantization Error Computation

  • Quantization error analysis

    The mean value of e[n] is zero, and its variance is

    Since

    For a (B+1)-bit quantizer with full-scale value Xm, the noise variance, or power, is

    121 22/

    2/

    22 =

    =

    deee

    BmX

    2=

    122 222 m

    B

    e

    X=

  • Quantization error analysis

    A common measure of the amount of degradation of a signal by additive noise is the signal-to-noise ratio (SNR), defined as the ratio of signal variance (power) to noise variance. Expressed in decibels (dB), the SNR of a (B+1)-bit quantizer is

    Hence, the SNR increases approximately 6dB for each bit added to the world length of the quantized samples.

    +=

    =

    =

    x

    m

    m

    x

    B

    e

    x

    XB

    XSNR

    10

    2

    22

    102

    2

    10

    log208.1002.6

    212log10log10