1 Basics DSP AV Intro

download 1 Basics DSP AV Intro

of 36

Transcript of 1 Basics DSP AV Intro

  • 8/10/2019 1 Basics DSP AV Intro

    1/36

    Basics on Digital Signal Processing

    Introduction

    Vassilis Anastassopoulos

    Electronics Laboratory, Physics Department,

    University of Patras

  • 8/10/2019 1 Basics DSP AV Intro

    2/36

    2/36

    Outline of the Course

    1. Introduction (samplingquantization)

    2. Signals and Systems

    3. Z-Transform

    4. The Discreet and the Fast Fourier Transform

    5. Linear Filter Design

    6. Noise

    7. Median Filters

  • 8/10/2019 1 Basics DSP AV Intro

    3/36

    3/36

    -0.2

    -0.1

    0

    0.1

    0.20.3

    0 2 4 6 8 10sampling time, tk [ms]

    Voltage[V]

    ts

    -0.2

    -0.1

    0

    0.1

    0.20.3

    0 2 4 6 8 10sampling time, tk [ms]

    Voltage[V]

    ts

    Analog & digital signals

    Continuous functionV

    of continuousvariable t

    (time, space etc) : V(t).

    Analog

    Discrete functionVkofdiscretesampling

    variable tk, with k =

    integer: Vk = V(tk).

    Digital

    -0.2

    -0.1

    0

    0.1

    0.20.3

    0 2 4 6 8 10

    time [ms]

    Voltage[V]

    Uniform (periodic) sampling.Sampling frequency fS= 1/ tS

    SampledSignal

  • 8/10/2019 1 Basics DSP AV Intro

    4/36

    4/36

    Analog & digital systems

  • 8/10/2019 1 Basics DSP AV Intro

    5/36

    5/36

    Digital vsanalog processingDigital Signal Processing (DSPing)

    More flexible.

    Often easier system upgrade.

    Data easily stored -memory.

    Better control over accuracy

    requirements.

    Reproducibility.

    Linear phase

    No drift with time and

    temperature

    Advantages

    A/D & signal processors speed:

    wide-band signals still difficult to

    treat (real-time systems).

    Finite word-length effect.

    Limitations

  • 8/10/2019 1 Basics DSP AV Intro

    6/36

    6/36

    DSPing: aim & tools

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

    High level languages: Matlab, Mathcad, Mathematica

    Dedicated tools (ex: filter design s/w packages).

    Applications Predicting a systems output.

    Implementing a certain processing task.

    Studying a certain signal.

    General purpose processors (GPP), -controllers.

    Digital Signal Processors (DSP).

    Programmable logic ( PLD, FPGA ).

    Hardware real-timeDSPing

    Fast

    Faster

  • 8/10/2019 1 Basics DSP AV Intro

    7/36

    7/36

    Related areas

  • 8/10/2019 1 Basics DSP AV Intro

    8/36

    8/36

    Applications

  • 8/10/2019 1 Basics DSP AV Intro

    9/36

    9/36

    Important digital signals

    Unit Impulse or Unit Sample.

    The most important signal for

    two reasons

    (n)=1 for n=0

    Unit Step u(n)=1 for n0(n)=u(n)-u(n-1)

    Unit Ramp r(n)=nu(n)

    (nTs) [(n-3)s]

    ns past

    u(nTs)

    ns past

    r(nTs)

    ns past

  • 8/10/2019 1 Basics DSP AV Intro

    10/36

    10/36

    Digital system example

    ms

    V ANALOG

    DOMAIN

    ms

    VFilter

    Antialiasing

    k

    A D

    IGITAL

    D

    OMAIN

    A/D

    k

    A

    DigitalProcessing

    ms

    V ANALOG

    DOMAIN

    D/A

    ms

    V FilterReconstruction

    Sometimes steps missing

    - Filter + A/D

    (ex: economics);- D/A + filter

    (ex: digital output wanted).

    General scheme

    Topics of thislecture.

    DigitalProcessing

    FilterAntialiasing

    A/D

  • 8/10/2019 1 Basics DSP AV Intro

    11/36

    11/36

    Digital system implementation

    Sampling rate.

    Pass / stop bands.

    KEY DECISION POINTS:

    Analysis bandwidth, Dynamic range

    No. of bits. Parameters.

    1

    2

    3

    Digital

    Processing

    A/D

    AntialiasingFilter

    ANALOG INPUT

    DIGITAL OUTPUT

    Digital format.What to use for processing?

  • 8/10/2019 1 Basics DSP AV Intro

    12/36

    12/36

    AD/DA Conversion General Scheme

  • 8/10/2019 1 Basics DSP AV Intro

    13/36

    13/36

    AD Conversion - Details

  • 8/10/2019 1 Basics DSP AV Intro

    14/36

    14/36

    Sampling

  • 8/10/2019 1 Basics DSP AV Intro

    15/36

    15/36

    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.

    Frequency misidentification due to low sampling frequency.

    Train starts wheels go clockwise.

    Train accelerates wheels go counter-clockwise.

    1

    Why?

  • 8/10/2019 1 Basics DSP AV Intro

    16/36

    16/36

    Rotating Disk

    How fast do we have to instantlystare at the disk if it rotateswith frequency 0.5 Hz?

  • 8/10/2019 1 Basics DSP AV Intro

    17/36

    17/36

    The sampling theorem

    A signal s(t) with maximum frequency fMAX

    can berecovered if sampled at frequency fS> 2 fMAX.

    Condition on fS?

    fS> 300 Hz

    t)cos(100t)sin(30010t)cos(503s(t)

    F1=25 Hz, F2= 150 Hz, F3= 50 Hz

    F1 F2 F3

    fMAX

    Example

    1

    Theo*

    *Multiple proposers: Whittaker(s), Nyquist, Shannon, Kotelnikov.

    Nyquist frequency (rate) fN= 2 fMAXor fMAXor fS,MINor fS,MIN/2

    Naming gets

    confusing !

  • 8/10/2019 1 Basics DSP AV Intro

    18/36

    18/36

    Sampling and Spectrum

  • 8/10/2019 1 Basics DSP AV Intro

    19/36

    19/36

    Sampling low-pass signals

    -B 0 B f

    Continuous spectrum(a) Band-limited signal:

    frequencies in [-B, B] (fMAX= B).

    (a)

    -B 0 B fS/2 f

    Discrete spectrum

    No aliasing (b) Time sampling frequency

    repetition.fS> 2 B no aliasing.

    (b)

    1

    0 fS/2 f

    Discrete spectrum

    Aliasing & corruption(c)

    (c) fS 2 B aliasing !

    Aliasing: signal ambiguityin frequency domain

  • 8/10/2019 1 Basics DSP AV Intro

    20/36

    20/36

    Antialiasing filter

    -B 0 B f

    Signal of interest

    Out of bandnoise Out of bandnoise

    -B 0 B fS/2

    (a),(b)Out-of-bandnoise can aliase

    into band of interest. Filter it before!

    (a)

    (b)

    (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, stopband

    frequency...

    (c)Antialiasing filter

    1

  • 8/10/2019 1 Basics DSP AV Intro

    21/36

    21/36

    Under-sampling1

    Using spectral replications to reduce

    sampling frequency fSreqments.

    m

    BCf2Sf

    1m

    BCf2

    m , selected so that fS> 2B

    B

    0 fC

    Bandpass signal

    centered on fC

    -fS 0 f

    S 2f

    S

    fC

    Advantages

    Slower ADCs / electronics

    needed.

    Simpler antialiasing filters.

    fC = 20 MHz, B = 5MHz

    Without under-samplingfS> 40 MHz.

    With under-samplingfS= 22.5 MHz (m=1);

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

    Example

  • 8/10/2019 1 Basics DSP AV Intro

    22/36

    22/36

    Quantization and Coding

    q

    N Quantization Levels

    Quantization Noise

  • 8/10/2019 1 Basics DSP AV Intro

    23/36

    23/36

    SNR of ideal ADC2

    )qRMS(e

    inputRMS

    10log20idealSNR(1)

    Also called SQNR

    (signal-to-quantisation-noise ratio)

    Ideal ADC: only quantisation erroreq(p(e)constant, no stuck bits)

    equncorrelated with signal.

    ADC performance constant in time.

    Assumptions

    22

    FSRVT

    0

    dt2

    tsin2

    FSRV

    T

    1inputRMS

    Input(t) = VFSRsin(t).

    12N2

    FSRV

    12

    qq/2

    q/2-

    qdeqep2qe)qRMS(e

    eeqqError value

    pp((ee))quantisation error probability density

    1q

    q2

    q2

    (sampling frequency fS= 2 fMAX)

  • 8/10/2019 1 Basics DSP AV Intro

    24/36

    24/36

    SNR of ideal ADC - 2

    [dB]1.76N6.02SNRideal (2)Substituting in (1) :

    One additional bit SNR increased by 6 dB

    2

    Actually(2) needs correction factor depending on ratio between sampling freq

    & Nyquist freq. Processing gain due to oversampling.

    - Real signals have noise.

    - Forcing input to full scale unwise.

    - Real ADCs have additional noise (aperture jitter, non-linearities etc).

    Real SNR lower because:

  • 8/10/2019 1 Basics DSP AV Intro

    25/36

    25/36

    Coding - Conventional

  • 8/10/2019 1 Basics DSP AV Intro

    26/36

    26/36

    Coding Flash AD

  • 8/10/2019 1 Basics DSP AV Intro

    27/36

    27/36

    DAC process

  • 8/10/2019 1 Basics DSP AV Intro

    28/36

    28/36

    Oversampling Noise shaping

    fs=4fN(b)

    (a)

    f

    ffN

    Oversampling OSR=4

    Nyquist SamplerPSD

    fb The oversampling process takes apart

    the images of the signal band.

    PSD

    fN/20

    SignalQuantization noise in

    Nyquist converters

    fs/2

    Quantization noise in

    Oversampling converters

    When the sampling rate increases (4times) the quantization noise spreads

    over a larger region. The quantization

    noise power in the signal band is 4 times

    smaller.

    frequency

    PSD

    FN/20

    SignalQuantization noise

    Nyquist converters

    Fs/2

    Quantization noise

    Oversampling converters

    Quantization noise

    Oversampling and noiseshaping converters

    Spectrum at the output of a noiseshaping quantizer loop compared to

    those obtained from Nyquist and

    Oversampling converters.

  • 8/10/2019 1 Basics DSP AV Intro

    29/36

    29/36

    A discreet-time system is a device or algorithmthat operates on an input sequence according tosome computational procedure

    Digital Systems

    It may be

    A general purpose computerA microprocessordedicated hardwareA combination of all these

  • 8/10/2019 1 Basics DSP AV Intro

    30/36

    30/36

    Linear, Time Invariant Systems

    N

    k

    k knxany0

    )()(

    System Properties

    linearTime InvariantStableCausal

    Convolution

  • 8/10/2019 1 Basics DSP AV Intro

    31/36

    31/36

    Linear Systems - Convolution

    5+7-1=11 terms

  • 8/10/2019 1 Basics DSP AV Intro

    32/36

    32/36

    Linear Systems - Convolution

    5+7-1=11 terms

  • 8/10/2019 1 Basics DSP AV Intro

    33/36

    33/36

    L

    k

    k

    M

    k

    k knybknxany10

    )()()(

    General Linear Structure

  • 8/10/2019 1 Basics DSP AV Intro

    34/36

    34/36

    Simple Examples

  • 8/10/2019 1 Basics DSP AV Intro

    35/36

    35/36

    LinearitySuperposition Frequency Preservation

    Principle of Superposition

    H

    y1(n)x1(n)

    H

    y2n)x2(n)

    H

    ay1(n)+by2(n)ax1(n)+bx2(n)

    Principle of Superposition Frequency Preservation

    x2

    x12(n)x1(n)

    x2(n)

    x1(n)+x2(n)

    x2

    x2

    x22(n)

    x12(n)+x2

    2(n)+2 x1(n) x2(n)

    If y(n)=x2(n) then for x(n)=sin(n)y(n)=sin2(n)=0.5+0.5cos(2n)

    Non-linear

  • 8/10/2019 1 Basics DSP AV Intro

    36/36

    36/36

    The END

    Back on Tuesday

    Have a nice Weekend