107 views

Uploaded by Bedanga Kashyap

- 6301 Touch Screen Controller
- 17689294 Handbook of Instrumental Techniques for Analytical
- Signals and Systems
- Analytical Chemistry
- Scan Sampling
- noise
- Electronic Circuits
- Acquisition and Conversion
- Sampling
- Digital to Analog Convertors
- Analytical Chemistry
- About Oscilloscope Functioning
- 6765 AdvancedGenerator NF 20170130 Web5
- Simulation of Power System Transient Disturbances
- r k kanodia2
- Digital Video Signal
- Gekko 64x64
- Raspberry Pi
- Data communication (PCM)
- Data Acquisition And siginal processing for smart sensors

You are on page 1of 34

Interpolation

Yao Wang

Polytechnic University, Brooklyn, NY11201

http://eeweb.poly.edu/~yao

Outline

– A/D and D/A converters

• Sampling

– Nyquist sampling theorem

– Aliasing due to undersampling:

• temporal and frequency domain interpretation

• Sampling sinusoid signals

• Reconstruction from samples

– Reconstruction using sample-and-hold and linear interpolation

– Frequency domain interpretation (sinc pulse as interpolation kernel)

• Sampling rate conversion

– Down sampling

– Up sampling

– Demonstration

Analog to Digital Conversion

1

T=0.1

Q=0.25

0.5

-0.5

-1

A2D_plot.m

Two Processes in A/D Conversion

Sampling Quanti-

zation

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

Sampling Quantization

Period Interval

T Q

• Sampling: take samples at time nT

– T: sampling period;

x[ n] = x( nT ),−∞ < n < ∞

– fs = 1/T: sampling frequency

– Q: quantization interval or stepsize

xˆ[ n] = Q[ x(nT )]

How to determine T and Q?

– A fast varying signal should be sampled more frequently!

– Theoretically governed by the Nyquist sampling theorem

• fs > 2 fm (fm is the maximum signal frequency)

• For speech: fs >= 8 KHz; For music: fs >= 44 KHz;

• Q depends on the dynamic range of the signal amplitude and

perceptual sensitivity

– Q and the signal range D determine bits/sample R

• 2R=D/Q

• For speech: R = 8 bits; For music: R =16 bits;

• One can trade off T (or fs) and Q (or R)

– lower R -> higher fs; higher R -> lower fs

• We consider sampling in this lecture, quantization in the next

lecture

Nyquist Sampling Theorem

• Theorem:

– If xc(t) is bandlimited, with maximum frequency fm (or ωm =2π fm )

– and if fs =1/T > 2 fm or ωs =2π /T >2 ωm

– Then xc(t) can be reconstructed perfectly from x[n]= xc(nT) by

using an ideal low-pass filter, with cut-off frequency at fs/2

– fs0 = 2 fm is called the Nyquist Sampling Rate

• Physical interpretation:

– Must have at least two samples within each cycle!

Temporal Domain Interpretation:

Sampling of Sinusoid Signals

Sampling above

Nyquist rate

ωs=3ωm>ωs0

Reconstructed

=original

Sampling under

Nyquist rate

ωs=1.5ωm<ωs0

Reconstructed

\= original

Aliasing: The reconstructed sinusoid has a lower frequency than the original!

Frequency Domain

Interpretation of Sampling

Original signal

Sampling

impulse train The spectrum of the

sampled signal includes

the original spectrum and

its aliases (copies) shifted

Sampled signal to k fs , k=+/- 1,2,3,…

ωs>2 ωm The reconstructed signal

from samples has the

frequency components

upto fs /2.

Sampled signal

ωs<2 ωm When fs< 2fm , aliasing

(Aliasing effect) occur.

Sampling of Sinusoid in Frequency

Domain

Spectrum of

cos(2πf0t)

-f0 0 f0

No aliasing

fs >2f0

fs -f0 >f0

Reconstructed

-fs -f0 -fs -fs+f0 -f0 0 f0 fs-f0 fs fs+f0

signal: f0

-fs/2 fs/2

With aliasing

f0<fs <2f0 (folding) 0

fs -f0 <f0

Reconstructed signal: fs -f0 -fs -f0 -fs -f0 -fs+f0 fs-f0 f0 fs fs+f0

With aliasing

fs <f0 (aliasing) -fs

0 fs

f0-fs <f0

Reconstructed signal: fs -f0 -fs -f0 -f0 -f0+fs f0-fs f0 fs+f0

More examples with Sinusoids

demo

– Aliasing: fs < fm (perceived frequency: fm -fs )

– Folding: fm < fs < 2fm (perceived frequency: fs -fm )

– No need to distinguish these two phenomena. Both lead to a

false frequency lower than the original frequency

Strobe Movie

How to determine the necessary sampling

frequency from a signal waveform?

should be at least two samples in the shortest ripple

• The inverse of its length is approximately the highest

frequency of the signal

Fmax=1/Tmin

Tmin

samples in this

interval, in order not

to miss the rise and

fall pattern.

Sampling with Pre-Filtering

Pre-Filter Periodic

H (f) Sampling

x(t) x’(t) xd(n)

Sampling

period T

• To prevent aliasing, pre-filter the continuous signal so that fm<fs/2

• Ideal filter is a low-pass filter with cutoff frequency at fs/2

(corresponding to sync functions in time)

•Common practical pre-filter: averaging within one sampling interval

How to Recover Continuous Signals

from Samples?

– Sampling and hold (rectangular kernels)

– Linear interpolation (triangular kernels)

– High order kernels

– Ideal kernel: sinc function

Sample-and-Hold vs. Linear

Interpolation

1.2

0.6

Reconstructed signal by linear interpolation

0.4

0.2

0

0 1 2 3 4 5 6 7 8 9 10

Reconstruction Using Different

Kernels

“reconstruction”

Frequency domain interpretation

Original signal

Sampled signal

ωs>2 ωm

Ideal

reconstruction filter

(low-pass)

Reconstructed signal

(=Original signal)

Ideal Interpolation Filter

Hr(f)

T

f

- fs/2 fs/2

T | f |< f s / 2 sin π t / T

H r ( f )= hr (t ) =

0 otherwise π t /T

∞ ∞

sin[ π (t − nT ) / T ]

xr (t ) = xs (t ) ∗ hr (t ) = ∑ x[n] hr (t − nT ) = ∑ x[n]

π (t − nT ) / T

n =−∞ n =−∞

Sampling Rate Conversion

sampling rate

– Necessary for image display when original image size differs

from the display size

– Necessary for converting speech/audio/image/video from

one format to another

– Sometimes we reduce sample rate to reduce the data rate

• Down-sampling: reduce the sampling rate

• Up-Sampling: increase the sampling rate

Down-Sampling Illustration

1.2

0.8

Down-sampling by a

0.6

factor of 2 = take

0.4

every other sample

0.2

0 To avoid aliasing of

0 1 2 3 4 5 6 7 8 9 10

any high frequency

content in the

original signal,

1.2

should smooth the

1

original signal before

0.8 down-sampling --

0.6 Prefiltering

0.4

0.2

0

0 1 2 3 4 5 6 7 8 9 10

Down Sampling by a Factor of M

– T’=MT, fs’=fs/M

• Should apply a prefilter to limit the bandwidth of the original signal to

1/M-th of the original

• Without prefiltering, aliasing occur in the down-sampled signal.

• Ideal prefilter: low pass filter with cut-off frequency at 1/M (maximum

digital frequency=1, corresponding to fs/2)

• Practical filter: averaging or weighted average over a neighborhood

Low-pass filter

Gain: M M

Cut-off: 1/M

x [n] x’[n] xd [n] = x [nM]

Down-Sampling Example

– Original sequence: 1,3,4,7,8,9,13,15…

– Without prefiltering, take every other sample:

• 1,4,8,13,…

– With 2-sample averaging filter

• Filtered value=0.5*self+0. 5*right, filter h[n]=[0.5,0.5]

• Resulting sequence:

– 2, 5.5,8.5,14,…

– With 3-sample weighted averaging filter

• Filtered value=0.5*self+0.25*left+0.25*right, filter h[n]=[0.25,0.5,0.25]

• Resulting sequence (assuming zeros for samples left of first):

– 1.25, 4.5,8,12.5,…

Upsampling by linear interpolation

1.2

0.8

0.6

0.4

0.2

0

0 1 2 3 4 5 6 7 8 9 10

1.2

0.8

0.6

0.4

0.2

0

0 1 2 3 4 5 6 7 8 9 10

Missing samples need to be filled from neighboring available samples using interpolation filter

Up Sampling by a Factor of L

• T’=T/L, fs’=fs*L

– The estimation of the missing samples from original samples is

known as interpolation

• Interpolation can be decomposed into two steps

– Zero-padding: insert L-1 zeros in between every two samples

– Low-pass filtering: to estimate missing samples from neighbors

– Simplest interpolation filter: linear interpolation

Lowpass Filter

L Gain = L

Cutoff = 1 / L

x[n] xe [n] xi [n]

period T padding period T’ = T/L period T’ = T/L

Up-Sample Example

of 2

– Original sequence: 1,3,4,7,8,9,13,15…

– Zero-padding:

• 1,0,3,0,4,0,7,0,…

– Sample and hold

• Repeat the left neighbor, filter h[n]=[1,1]

• 1,1,3,3,4,4,7,7,…

– With linear interpolation

• New sample=0.5*left+0. 5*right, filter h[n]=[0.5,1,0.5]

• Resulting sequence:

– 1,2,3,3.5,4,5.5,7,8,…,…

Demonstration

different pre-filters, and up-sampling with different

interpolation filters

• Compare both sound quality and frequency spectrum

• Matlab code (sampling_demo.m)

Down-2 followed by up-2, both using good filters

y psd-y

0.4 0

0.2

-20

0

-0.2 -40

-0.4

-60

5000 10000 15000 0 5000 10000

0.4 0 0

0.2 -20

-20 0.4

-40

0

0.2

-40 -60

-0.2

0 -80

-0.4

-60

2000 4000 6000 0 5000 10000 -10 0 10 0 0.2 0.4 0.6 0.8

0.4 0

0

1

0.2

-20

0 0.5 -50

-0.2 -40

0

-0.4 -100

-60

5000 10000 15000 0 5000 10000 -5 0 5 0 0.2 0.4 0.6 0.8

Down-2 followed by up-2, both using bad filters

y psd-y

0.4 0

0.2

-20

0

-0.2 -40

-0.4

-60

5000 10000 15000 0 5000 10000

0 0

0.2 -10

-20 0.4

-20

0

0.2 -30

-40

-0.2

-40

0

-0.4 -60 -50

2000 4000 6000 0 5000 10000 0 0.2 0.4 0.6 0.8

0

0

1

0.2

-20 -20

0 0.5

-40

-40

-0.2

0 -60

-0.4 -60

5000 10000 15000 0 5000 10000 -2-1 0 1 2 0 0.2 0.4 0.6 0.8

Down-4 followed by up-4, both using good filters

y psd-y

0.4 0

0.2

-20

0

-0.2 -40

-0.4

-60

5000 10000 15000 0 5000 10000

0 0

0.2

-20 0.4

0 -50

0.2

-40

-0.2

0

-60 -100

1000 2000 3000 0 5000 10000 -10 0 10 0 0.2 0.4 0.6 0.8

0

0

1

0.2

-20

-50

0 0.5

-40 -100

-0.2

0

-60 -150

5000 10000 15000 0 5000 10000 -10 0 10 0 0.2 0.4 0.6 0.8

Down-4 followed by up-4, both using bad filters

y psd-y

0.4 0

0.2

-20

0

-0.2 -40

-0.4

-60

5000 10000 15000 0 5000 10000

0 0

-10

0.2 0.4

-20 -20

0 -30

0.2

-40

-0.2 -40

0

-50

-60

1000 2000 3000 0 5000 10000 -1012 0 0.2 0.4 0.6 0.8

0

1 0

0.2

-20

-20

0 0.5

-40 -40

-0.2

0 -60

-60

5000 10000 15000 0 5000 10000 -4-3-2-101234 0 0.2 0.4 0.6 0.8

MATLAB Code

What Should You Know (I)

• Sampling:

– Know the minimally required sampling rate:

• fs > 2 fmax , Ts < T0,min /2

• Can estimate T0,min from signal waveform

signal is under-sampled.

– Can plot the spectrum of a sampled signal

• The sampled signal spectrum contains the original spectrum and its

replicas (aliases) at kfs, k=+/- 1,2,….

• Can determine whether the sampled signal suffers from aliasing

– Understand why do we need a prefilter when sampling a signal

• To avoid alising

• Ideally, the filter should be a lowpass filter with cutoff frequency at fs /2.

– Can show the aliasing phenomenon when sampling a sinusoid

signal using both temporal and frequency domain interpretation

What Should You Know (II)

• Interpolation:

– Can illustrate sample-and-hold and linear interpolation from

samples.

– Understand why the ideal interpolation filter is a lowpass filter with

cutoff frequency at fs /2.

– Know the ideal interpolation kernel is the sinc function.

– Interpolation using the sinc kernel is NOT required

– Know the meaning of down-sampling and upsampling

– Understand the need for prefiltering before down-sampling

• To avoid aliasing

• Know how to apply simple averaging filter for downsampling

– Can illustrate up-sampling by sample-and-hold and linear

interpolation

References

– Has good conceptual / graphical interpretation

(copies provided, Sec. 4.3,4.5 not required)

and sampling rate conversion. Sec. 1,2. (copy provided)

– Optional reading (More depth in frequency domain interpretation)

- 6301 Touch Screen ControllerUploaded bysbsridhar5624
- 17689294 Handbook of Instrumental Techniques for AnalyticalUploaded byPrashant Garg
- Signals and SystemsUploaded byMadhu Tellakukla
- Analytical ChemistryUploaded byRana Vivek Singh
- Scan SamplingUploaded byrehan ul haq
- noiseUploaded bySami Ullah
- Electronic CircuitsUploaded byarzoo105
- Acquisition and ConversionUploaded byrolandoflow
- SamplingUploaded bywallhisg
- Digital to Analog ConvertorsUploaded byAşšAśsins BRoš
- Analytical ChemistryUploaded bySandeep Kumar Thatikonda
- About Oscilloscope FunctioningUploaded bySunil Patel
- 6765 AdvancedGenerator NF 20170130 Web5Uploaded byIvo
- Simulation of Power System Transient DisturbancesUploaded byAhmed58seribegawan
- r k kanodia2Uploaded bySamir Panda
- Digital Video SignalUploaded byjuhi993
- Gekko 64x64Uploaded byMuhammed Thanseer
- Raspberry PiUploaded bynaskan1983
- Data communication (PCM)Uploaded bySiddhartha Gupta
- Data Acquisition And siginal processing for smart sensorsUploaded byGopi Nadh
- DQ UserManualUploaded byFranklin Hall
- adc-207Uploaded byjuvel_mtl_
- TCS230 Color SensorUploaded byJoséDavidFiloteo
- MM_BSC_SOLNS_2002Uploaded byKhan Muhammad Zaid
- conversor_picUploaded byJose Maria Alfonso Barroso
- The Audio Critic 16 rUploaded byDale Chenery
- Vetterli86aUploaded byskh_1987
- Comm Lab FileUploaded byAnkit Goel
- Front Page of Btech project ISt/ECEUploaded bySubir Maity
- SYSC 4405 - Quiz5b SolutionUploaded byAleksandra Diotte

- Inter Vehicular CommunicationUploaded byBedanga Kashyap
- imrbinternational-130720121305-phpapp02Uploaded byBedanga Kashyap
- MintUploaded byBedanga Kashyap
- project report for MBA studentUploaded bySuman Das
- The Online QuizUploaded byBedanga Kashyap
- proUploaded byBedanga Kashyap
- cHAPER 2_9-roparUploaded byBedanga Kashyap
- Research MethodsUploaded byMaria Anna Manalo

- AcerUploaded byCheng Ching Hao
- AP Statistics on the Casio PrizmUploaded byrothstem
- Asap Isatis 1Uploaded byisdba
- ReadMe_CoDesys.pdfUploaded byIsrael
- Manual of Std ProceduresUploaded byMuhammad Jawad Ansari
- AN4058Uploaded bygaurav thote
- Gta ChestsUploaded byhunnychugh14
- ASIC FAQUploaded byVinayak Katharki
- Director IT Enterprise Applications in Atlanta GA Resume Hiren DesaiUploaded byHirenDesai
- Information Gathering and ProcessingUploaded byUdit Chauhan
- Seismic InversionUploaded byjose_regueiro_4
- Cagliano, Caniato, Spina - 2004 - Lean, Agile and Traditional Supply How Do They Impact Manufacturing PerformanceUploaded byDragan Dragičević
- NotesUploaded byMicheal Hassel
- PipelineUploaded byarashmidos200x
- Lesson PlanUploaded byEly Boy Antofina
- Jotron TR_7750 n 7725 Product Brochure_2009 AprilUploaded byhishamuddinohari
- 2411372-IEC-81346-2-2009-Industrial-systems-installations-and-equipment-and-industrial-products-Pt2-Classification-of-objects-and-codes-for-classes-pdf.pdfUploaded byiennin
- Construct a Grid Computing Environment on Multiple Linux PC ClustersUploaded byYassine Afiniss
- apicUploaded bySridhar Reddy
- Java Execption handlingUploaded bySirisha Kurakula
- FAQs Quick Books 2008 Net InstallUploaded bydgruesso
- informatics practices project class xiiUploaded byAbhinav Kumar Sinha
- ACS712 Current Sensor Module (20A) User's Manual v1.0Uploaded byAlviss Seng
- RBNRUploaded byhorape
- Modelling An Overland Water Flow Path In An Urban Catchment Using GISUploaded byAI Coordinator - CSC Journals
- delee b week4 rfp mgmt408Uploaded byapi-246193480
- 239079566-Assembler-Book.pdfUploaded byborisg3
- Test OrderUploaded byxuni34
- Write the Number 48028 in WordsUploaded byAtheeswari Kulothungan
- 1Uploaded byMayure