Lecture 10 Sampling Theorem 3 & FIR Filters

31
Fundamentals of Digital Signal Processing Lecture 10 Sampling Theorem 3 Fundamentals of Digital Signal Processing Spring, 2012 Wei-Ta Chu 2012/4/10 1 DSP, CSIE, CCU

Transcript of Lecture 10 Sampling Theorem 3 & FIR Filters

Page 1: Lecture 10 Sampling Theorem 3 & FIR Filters

Fundamentals of Digital Signal Processing

Lecture 10 Sampling Theorem 3

Fundamentals of Digital Signal ProcessingSpring, 2012

Wei-Ta Chu2012/4/10

1 DSP, CSIE, CCU

Page 2: Lecture 10 Sampling Theorem 3 & FIR Filters

Interpolation with Pulses� Obviously, the important issue is the choice of the

pulse waveform p(t).

� Four possible pulse waveformsfor D-to-C conversion whenfs = 200 Hz

� T = 5 msec

DSP, CSIE, CCU2

� Ts = 5 msec

Page 3: Lecture 10 Sampling Theorem 3 & FIR Filters

Zero-Order Hold Interpolation� The simplest pulse shape is a symmetric square pulse

� In this example, the total widthof the square pulse is Ts=5 msand its amplitude is 1.

DSP, CSIE, CCU3

and its amplitude is 1.

� Since a constant is a polynomial of zero order, and since the effect of the flat pulse is to hold or replace each sample for Ts sec, then used of a flat pulse is called a zero-order hold reconstruction

Page 4: Lecture 10 Sampling Theorem 3 & FIR Filters

Linear Interpolation� The triangular pulse defined as a pulse consisting of

the first-order polynomial segments

� The duration of the pulse is 2Ts, and they are shifted by multiples

DSP, CSIE, CCU4

and they are shifted by multiples of Ts.

� The result is that the samples areconnected by straight lines.

Page 5: Lecture 10 Sampling Theorem 3 & FIR Filters

Cubic SplineInterpolation� The cubic spline pulse has a duration twice of the triangular

pulse and four times of the square pulse. � This pulse has zeros at the key

locations:

� For values of t, four pulses overlap and must be added

DSP, CSIE, CCU5

overlap and must be added together

� The reconstructed signal at a particular time instant is the sumof these overlapping pulses, depending on two proceeding samples and two following samples

Page 6: Lecture 10 Sampling Theorem 3 & FIR Filters

Over-Sampling Aids Interpolation� One way to make a smooth reconstruction is to use p(t)

that is smooth and has a long duration.

� If the original waveform does not vary much over the duration of p(t), then we will also obtain a good reconstruction → oversampling

� Change the sampling frequency from f =200 Hz to 500

DSP, CSIE, CCU6

� Change the sampling frequency from fs=200 Hz to 500 Hz in the previous examples

� The duration of reconstruction pulses is changed from Ts=5 msec to 2 msec

Page 7: Lecture 10 Sampling Theorem 3 & FIR Filters

Over-Sampling Aids Interpolation

DSP, CSIE, CCU7

Page 8: Lecture 10 Sampling Theorem 3 & FIR Filters

Ideal BandlimitedInterpolation� What is the pulse shape that gives “ideal D-to-C

conversion”? (Chapter 12)

� The infinite length of this pulse implies that to reconstruct a signal at time t exactly from its samples

DSP, CSIE, CCU8

reconstruct a signal at time t exactly from its samples requires all the samples, not just those around that time.

� It’s called bandlimited interpolation

� Using this pulse to reconstruct from samples of a cosine wave will always produce a cosine wave exactly.

Page 9: Lecture 10 Sampling Theorem 3 & FIR Filters

The Sampling Theorem

A continuous-time signalx(t) with frequenciesno higher thanfmax can be reconstructed exactlyfrom its samplesx[n]=x(nTs), if the samples aretaken at a ratefs=1/Ts that is greater than 2fmax.

Shannon Sampling Theorem

DSP, CSIE, CCU9

Page 10: Lecture 10 Sampling Theorem 3 & FIR Filters

The Sampling Theorem� If the input is composed of sinusoidal signals limited

to the set of frequencies in the range , then the reconstructed signal is equal to the original signal that was sampled; i.e., y(t) = x(t).

� Signals composed of sinusoids such that all frequencies are limited to a “band of frequencies” are called bandlimited signals.

DSP, CSIE, CCU10

called bandlimited signals.

� Such an additive combination of cosine signals can produce an infinite variety of both periodic and nonperiodic signal waveforms.

Page 11: Lecture 10 Sampling Theorem 3 & FIR Filters

The Sampling Theorem� If we sample the signal

� If we sample a sum of continuous-time cosines, we obtain a sum of sampled cosines each of which would

DSP, CSIE, CCU11

obtain a sum of sampled cosines each of which would be subject to aliasing if the sampling rate is not high enough

� Discrete-to-continuous conversion by interpolation

Page 12: Lecture 10 Sampling Theorem 3 & FIR Filters

The Sampling Theorem

� Since each individual sinusoid is assumed to satisfy the conditions of the sampling theorem, it follows that the D-

DSP, CSIE, CCU12

to-C converter will reconstruct each component perfectly

� The Shannon sampling theorem applies to any signal that can be represented as a bandlimited sum of sinusoids.

Page 13: Lecture 10 Sampling Theorem 3 & FIR Filters

Homework 3� Chapter 4: P-4.1, 4.8, 4.13, 4.14

� Hand over your homework in the class at Apr. 17

DSP, CSIE, CCU13

Page 14: Lecture 10 Sampling Theorem 3 & FIR Filters

Fundamentals of Digital Signal Processing

Lecture 10 Introduction of FIR Filters

Fundamentals of Digital Signal ProcessingSpring, 2012

Wei-Ta Chu2012/4/10

14 DSP, CSIE, CCU

Page 15: Lecture 10 Sampling Theorem 3 & FIR Filters

Discrete-Time System� A discrete-time system is a computational process for

transforming one sequence, called the input signal, into another sequence called the output signal.

� The output sequence is related to the input sequence by a process that can be described mathematically by an

DSP, CSIE, CCU15

a process that can be described mathematically by an operator

� Examples:

Page 16: Lecture 10 Sampling Theorem 3 & FIR Filters

FIR Filter� A filter is a system that is designed to remove some

component or modify some characteristic of a signal, but often two terms are used interchangeably.

� FIR (finite impulse response) systems are systems for which each output sample is the sum of a finite number of weighted samples of the input sequence.

DSP, CSIE, CCU16

number of weighted samples of the input sequence.

Page 17: Lecture 10 Sampling Theorem 3 & FIR Filters

The Running-Average Filter� A simple FIR filter is to compute a moving average or

running average of two or more consecutive numbers of the sequence, thereby forming a new sequence of the average values.

� Example: the input is a finite-length signal, the supportof such a sequence is the set of values over which the

DSP, CSIE, CCU17

of such a sequence is the set of values over which the sequence is nonzero. � Support: the finite interval

Page 18: Lecture 10 Sampling Theorem 3 & FIR Filters

The Running-Average Filter� Output:

� The equation is called a difference equation. It’s a complete description of the FIR system because we can use it to

DSP, CSIE, CCU18

description of the FIR system because we can use it to compute the entire output signal for

n n<-2 -2 -1 0 1 2 3 4 5 n>5

x[n] 0 0 0 2 4 6 4 2 0 0

y[n] 0 2/3 2 4 14/3 4 2 2/3 0 0

Page 19: Lecture 10 Sampling Theorem 3 & FIR Filters

The Running-Average Filter� y[n] = 0 outside of the finite interval , i.e.

the output also has finite support� The output sequence is longer than the input sequence,

and that the output appears to be a somewhat rounded-off version of the input; i.e. it is smoother than the input sequence. This behavior is characteristic of running-average FIR filter.

DSP, CSIE, CCU19

running-average FIR filter. � The output starts (becomes nonzero) before the input

starts. � n would stand for time� Present output: y[n]� Inputs are indexed as n, n+1, n+2. Two of them are “in

the future”.

Page 20: Lecture 10 Sampling Theorem 3 & FIR Filters

The Running-Average Filter� In general, values from either the pastor the futureor

both may be used in the computation.

� A filter that uses only the present and past values of the input is called a causal filter.

� A filter that uses future values of the input is called noncausal.

DSP, CSIE, CCU20

noncausal.

Page 21: Lecture 10 Sampling Theorem 3 & FIR Filters

The Running-Average Filter� Change the difference equation

� It’s a causal running averager, or it may well be called a backward average.

n n<-2 -2 -1 0 1 2 3 4 5 6 7 n>7

x[n] 0 0 0 2 4 6 4 2 0 0 0 0

DSP, CSIE, CCU21

� The output of the causal filter is simply a shifted version of the output of the previous noncausal filter.

� The output doesn’t change from zero before the input changes from zero

x[n] 0 0 0 2 4 6 4 2 0 0 0 0

y[n] 0 0 0 2/3 2 4 14/3 4 2 2/3 0 0

Page 22: Lecture 10 Sampling Theorem 3 & FIR Filters

The General FIR Filter� If

� Then we have a length-4 filter with M = 3

� The parameter M is the order of the FIR filter. The

Mth order FIR filter

DSP, CSIE, CCU22

� The parameter M is the order of the FIR filter. The number of filter coefficients is also called the filter length (L). The length is one greater than the order, i.e. L=M+1

Page 23: Lecture 10 Sampling Theorem 3 & FIR Filters

An Illustration of FIR Filtering� Consider an input signal

� We often have real signals of this form: a component that is of interest (it may be the slowly varying exponential component (1.02)n) plus another

DSP, CSIE, CCU23

exponential component (1.02)n) plus another component that is not of interest. � The second component is often considered to be noise

that interferes with observation of the desired signal.

Page 24: Lecture 10 Sampling Theorem 3 & FIR Filters

An Illustration of FIR Filtering� Suppose that x[n] is the input to a

causal 3-point running averager

� (a)the output must be zero for n<0

� (b)shaded interval of length M=2 samples at the beginning

DSP, CSIE, CCU24

� (c) shaded interval of length M=2 samples at the end

� (d)the solid line showing the values of the exponential component has been shifted to the right by M/2=1 sample

Page 25: Lecture 10 Sampling Theorem 3 & FIR Filters

An Illustration of FIR Filtering� 7-point running averager

� (a) shaded region at the beginning and the end

� (b) the exponential component is very close to

DSP, CSIE, CCU25

component is very close to the exponential component of the input (after a shift of M/2=3 samples)

Page 26: Lecture 10 Sampling Theorem 3 & FIR Filters

Summary� (1) FIR filtering can modify signals in ways that may

be useful

� (2) The length of the averaging interval seems to have a big effect on the resulting output

� (3) The running-average filters appear to introduce a shift equal to M/2 samples

DSP, CSIE, CCU26

shift equal to M/2 samples

� We will gain full appreciation of this example only upon the completion of Chapter 6.

Page 27: Lecture 10 Sampling Theorem 3 & FIR Filters

The Unit Impulse Sequence� The unit impulse is perhaps the simplest sequence

because it has only one nonzero values, which occurs at n = 0. The mathematical notation is that of the Kronecker delta function

n … -2 -1 0 1 2 3 4 …

DSP, CSIE, CCU27

n … -2 -1 0 1 2 3 4 …

0 0 0 1 0 0 0 0 0

0 0 0 0 0 1 0 0 0

Page 28: Lecture 10 Sampling Theorem 3 & FIR Filters

The Unit Impulse Sequence� The shifted impulse is a concept that is very useful in

representing signals and systems.

n … -2 -1 0 1 2 3 4 …

0 0 0 2 0 0 0 0 0

0 0 0 0 4 0 0 0 0

DSP, CSIE, CCU28

0 0 0 0 4 0 0 0 0

0 0 0 0 0 6 0 0 0

0 0 0 0 0 0 4 0 0

0 0 0 0 0 0 0 2 0

0 0 0 2 4 6 4 2 0

Page 29: Lecture 10 Sampling Theorem 3 & FIR Filters

The Unit Impulse Sequence� Any sequence can be represented in this way. The

equation

is true if k ranges over all the nonzero values of the sequence x[n].

DSP, CSIE, CCU29

sequence x[n].

� The sequence is formed by using scaled shifted impulses to place samples of the right size at the right positions.

Page 30: Lecture 10 Sampling Theorem 3 & FIR Filters

Unit Impulse Response Sequence� When the input to the FIR filter is a unit impulse

sequence, , the output is the unit impulse response, denoted as h[n].

DSP, CSIE, CCU30

n <0 0 1 2 3 … M M+1 …

0 1 0 0 0 0 0 0 0

0 b0 b1 b2 b3 … bM 0 0

Page 31: Lecture 10 Sampling Theorem 3 & FIR Filters

Unit Impulse Response Sequence� The impulse response h[n] of the FIR filter is simply the

sequence of difference equation coefficients.

� Since h[n] = 0 for n<0 and for n>M, the length of the impulse response sequence h[n] is finite. This is why the system is called a finite impulse response (FIR) system.

DSP, CSIE, CCU31

The plot of the impulse response for the case of the causal 3-point running-average filter.