81
Signals and Networks Discussion#4 Tarun Choubisa Dept of ETC, KIIT University 19 January 2011 1

4 Discrete Time Convolution

Embed Size (px)

Citation preview

Page 1: 4 Discrete Time Convolution

Signals and Networks

Discussion#4

Tarun ChoubisaDept of ETC,

KIIT University

19 January 2011 1

Page 2: 4 Discrete Time Convolution

Resources

• O & W

• Ch. 2, Sect. 1-8 in Linear Signals & Systems, 2nd Ed. by Lathi

• http://www.jhu.edu/signals/

• http://www.isip.piconepress.com/projects/speech/software/demonstrations/applets/util/convolution/v6.0/

• http://www.see.ed.ac.uk/~mjj/dspDemos/EE4/tutConv.html

• http://www.see.ed.ac.uk/~mjj/dspDemos/EE4/tutConvDisc.html

• http://dsp.feit.ukim.edu.mk/demos/Konvolucija.html

• http://dsp.feit.ukim.edu.mk/demos/analogconv/Analog%20Convolution.html

• http://users.ece.gatech.edu/~bonnie/book/OnlineDemos/CTConv/

Page 3: 4 Discrete Time Convolution

Convolution• Definition: It is the tool or operation to determine the

response of the LTI system (h(n-k) is the output for shifted impulse and x(k) is the coefficient. )

• Convolution between two DT signals x(n) and h(n) is expressed as

Example: x(n) is input , h(n) = [ 1 0.8 0.4 0.01]• x(n)= { 1 3 2 1 2 2 1 1 3 2} y(n)

Put n-k=m where m is a Dummy variable.

Page 4: 4 Discrete Time Convolution

Convolution, time-invariance and linearity

[ ]h n m[ ]n m System time-invariance

LTIh[n]

[n] Y[n]=h[n]* [n]=h[n]

Response of at time is h[n].

By time invarianceResponse of m at time n is h[n-m].

n n

Page 5: 4 Discrete Time Convolution

Convolution, time-invariance and linearity

Page 6: 4 Discrete Time Convolution

convolution is linear and shift/time invariant

Convolution, time-invariance and linearity

Page 7: 4 Discrete Time Convolution

Linear time-invariant systems (LTI)• A sequence can be represented as a linear

combination of delayed impulses:

[ ] [ ] [ ]k

x n x k n k

• Let hk[n] be the response to [n-k] (an impulse at n = k)

If the system is linear

If the system is time-invariant

[ ] [ ]

[ ] [ ]k

y n T x n

T x k n k

[ ] [ ] [ ]

[ ] [ ]

[ ] [ ]

k

k

k

y n x k T n k

x k h n

x k h n k

Page 8: 4 Discrete Time Convolution

Convolution sum or superposition sum

[ ] [ ] [ ]

[ ] [ ] [ ]

k

y n x k h n k

y n x n h n

• Linear Time-Invariant(LTI) systems can be described by the convolution sum!

Convolution sum

[ ] [ ] [ ]

[ ] [ ] [ ]

x n x k n k

y n x k h n k

k

k nhkxny ][][][

Page 9: 4 Discrete Time Convolution

System Representation: Impulse Response

• Example: The discrete-time impulse response

Is completely described by the following LTI

• However, the following systems also have the same impulse response

• Therefore, if the system is non-linear, it is not completely characterised by the impulse response

]1[][][ nxnxny

2[ ] ( [ ] [ 1])

[ ] max( [ ], [ 1])

y n x n x n

y n x n x n

otherwise0

1,01][

nnh

Page 10: 4 Discrete Time Convolution

Computing DT Convolution

Page 11: 4 Discrete Time Convolution

Convolution: Graphical MethodSteps :

1) Reverse/flip one of the signal to get h[-k]

2) Shift right above signal by n to get h[-(k-n)]=h[n-k]

3) Multiply (dot product) h[n-k] with x[k] and sum up to get sample y[n]

4) Repeat step 2 and 3 for different values of n to get sample y[n]

Page 12: 4 Discrete Time Convolution

Convolution: Graphical Method

Page 13: 4 Discrete Time Convolution

Convolution: Graphical Method

• Shift by 0 to get y(0)

0 4 1 0 0 0 = 5 = y(0)

Page 14: 4 Discrete Time Convolution

Convolution: Graphical Method

• Shift by -1 to get y(-1)

0 0 2 0 0 0 0 = 2 = y(-1)

Page 15: 4 Discrete Time Convolution

Convolution: Graphical Method

• Shift by -2 to get y(-2)

0 0 0 0 0 0 0 0 = 0 = y(n) for n < -1

Page 16: 4 Discrete Time Convolution

Convolution: Graphical Method

• Shift by 1 to get y(1)

-2 2 -1 0 0 = -1 = y(1)

Page 17: 4 Discrete Time Convolution

Convolution: Graphical Method

• If x[n]=0 for n<N1 & h[n] is zero for n<N2, then x[n]*h[n]=0 for n<N1+N2 (O & W Q2.16a).• If x[n]=0 for n>N3 & h[n]=0for n>N4, then x[n]*h[n]=0 for n>N3+N4

Page 18: 4 Discrete Time Convolution

Convolution Output: Sum of scaled, shifted impulse response

• Consider a LTI system with the following unit impulse response:

h[n] = [0 0 1 1 1 0 0]

• For the input sequence:

x[n] = [0 0 0.5 2 0 0 0]

• The result is:

y[n] = … + x[0]h[n] + x[1]h[n-1] + …

= 0 + 0.5*[0 0 1 1 1 0 0] +

2.0*[0 0 0 1 1 1 0] +

0

= [0 0 0.5 2.5 2.5 2 0]

Page 19: 4 Discrete Time Convolution

Convolution Output: sample by sample• Consider the problem described

for previous example

• Sketch x[k] and h[n-k] for any particular value of n, then multiply the two signals and sum over all values of k.

• For n<0, we see that x[k]h[n-k] = 0 for all k, since the non-zero values of the two signals do not overlap.

• y[0] = kx[k]h[0-k] = 0.5

• y[1] = kx[k]h[1-k] = 0.5+2

• y[2] = kx[k]h[2-k] = 0.5+2

• y[3] = kx[k]h[3-k] = 2

• As found in Example 1

Page 20: 4 Discrete Time Convolution

Examples of DT Convolution• Example: unit-pulse

][][][

][][][

][][

nxknkx

knhkxny

nnh

k

k

• Example: delayed unit-pulse

][][][

][][][

][][

00

0

nnxknnkx

knhkxny

nnnh

k

k

• Example: unit step

n

kk

k

kxknukx

knhkxny

nunh

][][][

][][][

][][

Convolution with impulse give the o/p which is equal to i/p

Convolution with shifted impulse give the o/p which is equal to i/p which is shifted by same amount

• Convolution with impulse make the accumulator

Page 21: 4 Discrete Time Convolution

Convolution: Decaying signal to finally approach a constant value

Page 22: 4 Discrete Time Convolution

Convolution: Decaying signal to finally approach a constant value

Page 23: 4 Discrete Time Convolution

Convolution: Mathematical functions(both are infinitely right sided sequences)

• Consider a LTI system that has a impulse response h[n] = u[n] the unit step signal(special case when b=1)

• What is the response when an input signal of the form

x[n] = nu[n]

• where 0< <1, is applied?

• For n 0:

Therefore,

1

1

][

1

0

n

n

k

kny

][1

1][

1

nunyn

• When two causal systems are convolved, the final system will also be causal (O & W Q2.19b). • If x[n]=0 for n<N1 & h[n]=0 for n<N2, then x[n]*h[n]=0 for n<N1+N2 (O & W Q2.16a).

Page 24: 4 Discrete Time Convolution

Convolution: Mathematical functions(one isinfinitely right sided and another is finite seq.)

Page 25: 4 Discrete Time Convolution

Convolution: Mathematical functions(one isinfinitely right sided and another is finite seq.)

Page 26: 4 Discrete Time Convolution

Convolution: Mathematical functions(one isinfinitely right sided and another is finite seq.)

Page 27: 4 Discrete Time Convolution

Convolution: Mathematical functions(one isinfinitely right sided and another is finite seq.)

Page 28: 4 Discrete Time Convolution

Convolution: Filtering

Page 29: 4 Discrete Time Convolution

Convolution: Filtering

Page 30: 4 Discrete Time Convolution

Matlab Exploration

Page 31: 4 Discrete Time Convolution

Matlab Exploration: Visualization

Page 32: 4 Discrete Time Convolution

32

Example: Find y(t) = x(t)*h(t) for x(t) and h(t) shown below using the graphical method. Follow the procedure listed on the previous slide.

0 1

1

x(t)

0 1

2

h(t)

3tt

Solution:

1. Form x( ):

0 1

1

x( )

Example: Convolution Integral of two different duration pulses

Page 33: 4 Discrete Time Convolution

33

2. Form h(t - ):

0 1

2

h( )

3 0-1

2

h(- )

-3

0-1

2

h(t- )

-3

t

t-1t-3

Note: Remember that is the independent variable, not t. t is simply a constant. h(t - ) = h(- + t), so t is the amount of time shift.

3. Consider different ranges of t (time-shift):

Each range of t selected should result in different portions of the waveforms overlapping. The convolution y(t) = x(t)*h(t) is the area under the product of the overlapping portions.

Example: Convolution of two different duration pulses

Page 34: 4 Discrete Time Convolution

34

3A. First range selected: (- <t < 1):

This range results in no overlap for all values of (i.e., - < < ).

0

2

h(t- )

t-1t-3

h(t- ) sliding as t varies over the range - < t < 1

1

1

No overlap

x( )

1 t -for 0 y(t) so

d0 )-h(t)x( y(t) and

) allfor overlap (no - 0, )-h(t)x(

--

d

Example: Convolution of two pulses

Page 35: 4 Discrete Time Convolution

35

3B.Second range selected: (1 <t < 2): Left part come into overlap, right part not

This range results in an overlap from = 0 to = t-1.

0

2

h(t- )

t-1t-3

h(t- ) sliding as t varies over the range 1 < t < 2

1

1

Area of overlap between = 0 and = t-1

x( )

2 t 1for 1)-2(t 2 y(t)

d0 d2 d0 )-h(t)x( y(t) and

1-t0

1-t0221

00

)-h(t)x(

1t

0

0

-

1-t

0 1t-

d

Example: Convolution of two pulses

Page 36: 4 Discrete Time Convolution

36

3C.Third range selected: (2 <t < 3): full overlap

This range results in an overlap from = 0 to = 1.

0

2

h(t- )

t-1t-3

h(t- ) sliding as t varies over the range 2 < t < 3

1

1

Area of overlap between = 0 and = 1

x( )

3 t 2for 2 0)-2(1 2 y(t)

d2 )-h(t)x( y(t) and

10

10221

00

)-h(t)x(

1

0

1

0-

d

Example: Convolution of two pulses

Page 37: 4 Discrete Time Convolution

37

3D. Fourth range selected: (3 <t < 4): Right part is into overlap, left part go out

This range results in an overlap from = t-3 to = 1.

0

2

h(t- )

t-1t-3

h(t- ) sliding as t varies over the range 3 < t < 4

1

1

Area of overlap between = t-3 and = 1

x( )

4 t 3for 2t -8 t-42 3-t-12 2 y(t)

d2 )-h(t)x( y(t) and

10

13-t221

3t0

)-h(t)x(

1

3t

1

3t-

d

Example: Convolution of two pulses

Page 38: 4 Discrete Time Convolution

38

3E.Fifth range selected: (4 <t): fully go outside, no overlap

This range results in no overlap for all values of (i.e., - < < ).

0

2

h(t- )

t-1t-3

h(t- ) sliding as t varies over the

range t > 4

1

1

No overlap

x( )

t 4for 0 y(t) so

d0 )-h(t)x( y(t) and

) allfor overlap (no - 0, )-h(t)x(

--

d

Example: Convolution of two pulses

Page 39: 4 Discrete Time Convolution

39

5. Compile the results of y(t) over the five ranges. Also graph y(t).

t 40

4 t 382t-

3 t 22

2 t 12-2t

1 t 0

h(t)* x(t) y(t)

0

2

t431

y(t)

2

Example: Convolution of two pulses

Convolution: A mathematical operator which computes the “amount of overlap” between two functions. Can be thought of as a general moving average

Page 40: 4 Discrete Time Convolution

Convolution: Graphical RepresentationFor the first pulseAmp= 0.5Time = -0.5 : 0.5 secGreen one is the output if blue and red will convolve.

Convolution demohttp://www.jhu.edu/signals/http://www.isip.piconepress.com/projects/speech/software/demonstrations/applets/util/convolution/current/index.htmlhttp://dsp.feit.ukim.edu.mk/demos/Konvolucija.htmlhttp://dsp.feit.ukim.edu.mk/demos/analogconv/Analog%20Convolution.htmlhttp://users.ece.gatech.edu/~bonnie/book/OnlineDemos/CTConv/

Page 41: 4 Discrete Time Convolution

4 - 41

Communication:Transmit One Bit

• Transmission over communication channel (e.g. telephone line) is analog

h t

)(th

1

p t

)(1 tx

A

‘1’ bit

t

p

)(0 tx

-A

‘0’ bit

Model channel as LTI system with impulse responseh(t)

CommunicationChannel

input output

x(t) y(t)t

t

)(1 tyreceive‘1’ bit

)(0 ty

-A Th

receive ‘0’ bit

h+ p

th+ p

h

h

Assume that Th < Tp

A Th

Page 42: 4 Discrete Time Convolution

4 - 42

Transmit Two Bits (Interference)

• Transmitting two bits (pulses) back-to-back will cause overlap (interference) at the receiver

• How do we prevent intersymbolinterference at the receiver?

h t

)(th

1

Assume that Th < Tp

tp

)(tx

A

‘1’ bit ‘0’ bit

p

* =)(ty

-A Th

tp

‘1’ bit ‘0’ bit

h+ p

intersymbol interference

Page 43: 4 Discrete Time Convolution

13 - 43

Preventing ISI at Receiver• Option #1: wait Th seconds between pulses in

transmitter (called guard period or guard interval)

Disadvantages? Data rate reduces.

• Option #2: use channel equalizer in receiverFIR filter designed via training sequences sent by transmitterDesign goal: cascade of channel memory and channel

equalizer should give all-pass frequency response

h t

)(th

1

Assume that Th < Tb

* =

tb

)(tx

A

‘1’ bit ‘0’ bit

h+ b

t

)(ty

-A Th

b

‘1’ bit ‘0’ bit

h+ b

h

Page 44: 4 Discrete Time Convolution

Convolution: AC Frequency doesn’t change

Page 45: 4 Discrete Time Convolution

Convolution: AC Frequency doesn’t change

Page 46: 4 Discrete Time Convolution

Convolution: AC Frequency doesn’t change

Page 47: 4 Discrete Time Convolution

Convolution: AC Frequency doesn’t change

Page 48: 4 Discrete Time Convolution

Convolution: AC Frequency doesn’t change

Page 49: 4 Discrete Time Convolution

Convolution: AC Frequency doesn’t change

Page 50: 4 Discrete Time Convolution

Convolution: Amplitude and phase change

Page 51: 4 Discrete Time Convolution

Convolution: Amplitude and phase change

Page 52: 4 Discrete Time Convolution

Convolution: Amplitude and phase change

Page 53: 4 Discrete Time Convolution

Convolution: Amplitude and phase change

Page 54: 4 Discrete Time Convolution

54

Convolution can be performed by direct evaluation of the convolution integral (without sketching graphs) for fairly straightforward functions. This becomes difficult for piecewise-continuous functions, such as were used in many of our graphical examples.

Example 6: Evaluate y(t) = x(t)*h(t) for: x(t) = u(t), h(t) = u(t) by directly evaluating the convolution integral rather than through a graphical approach.

-

-

)d -)u(t u( y(t)

) )d -)h(t x( h(t)* x(t) y(t)

:Solution

n(definitio

u( ) = 1 only for > 0 so change lower limit to 0

u(t - ) = 1 only for < t so change upper limit to t

tu(t) t 0- t 1d1 y(t)t

0

t

0

so

A graphical approach would show that the functions overlap for 0 < t < or else note that x(t) and y(t) both are non-zero for t > 0.

sou(t)*u(t) = tu(t)

Convolution: direct integration

Page 55: 4 Discrete Time Convolution

55

Table 2-1 from Signals & Systems, 2nd Edition, by Lathi

Important Convolution

Page 56: 4 Discrete Time Convolution

Important Convolution

Table 9-1 from

Signals & Systems,

2nd Edition, by Lathi

Page 57: 4 Discrete Time Convolution

Convolution: Shifting Function Selection

Page 58: 4 Discrete Time Convolution

Convolution: Shifting Function Selection

• Line equation for f2(t- )=

• For

• Case(1): -0.5<=t<0

• Case(2): -0.5+t<=-0.5, t<0.5; 0<t<=0.5

• Case(3): -0.5+t<=0.5; 0.5<t<=1

2( 0.5)

2[ ( ) 0.5] 2[ 0.5]

2[ 0.5]

t

t

Select a piecewise constant amplitude function for reversal and shifting function. http://cnyack.homestead.com/files/aconv/conv2.htm

Hint: Shift and delay the simplest waveform

Page 59: 4 Discrete Time Convolution

• Solution• For this problem I choose to flip x[n]• Some authors prefer to flip the shorter signal. My

personal preference is to flip the simple signal although I sometimes don’t follow that “rule”…only through lots of practice you can learn how to best choose which one to flip.

Convolution: Shifting Function Selection

Page 60: 4 Discrete Time Convolution

Convolution: Shifting Function Selection

Page 61: 4 Discrete Time Convolution

Convolution: ramp up and ramp down

Page 62: 4 Discrete Time Convolution

Convolution: ramp up and ramp down

Page 63: 4 Discrete Time Convolution

Convolution: ramp up and ramp down

Page 64: 4 Discrete Time Convolution

Convolution: ramp up and ramp down

Page 65: 4 Discrete Time Convolution

Convolution: ramp up and ramp down

Page 66: 4 Discrete Time Convolution

Convolution: ramp up and ramp down

Page 67: 4 Discrete Time Convolution

Convolution: ramp up and ramp down

Page 68: 4 Discrete Time Convolution

Convolution: ramp up and ramp down

Page 69: 4 Discrete Time Convolution

Convolution: ramp up and ramp down

Page 70: 4 Discrete Time Convolution

Convolution: ramp up and ramp down

Page 71: 4 Discrete Time Convolution

Convolution: ramp up and ramp down

Page 72: 4 Discrete Time Convolution

Convolution: Big Picture

Book: Kamen and Heck

Page 73: 4 Discrete Time Convolution

Convolution

Page 74: 4 Discrete Time Convolution

Convolution: Matrix methodExpand the formula of convolution and find out the terms for different value of n.

Page 75: 4 Discrete Time Convolution

Convolution: Tabular Method

Page 76: 4 Discrete Time Convolution

Convolution: Implementation

Page 77: 4 Discrete Time Convolution

Uses/Application of Convolution

Page 78: 4 Discrete Time Convolution

EXAMPLE OF CONVOLUTION

* =

Page 79: 4 Discrete Time Convolution

(*)-1 =

DECONVOLUTION: A solution

Page 80: 4 Discrete Time Convolution

DECONVOLUTION

0

1

0

1

0

[ ] [ ]* [ ] [ ] [ ]

[ ] [ ] [ ] [ ] [0]

[ ] [ ] [ ]

[ ][0]

N

k

N

k

N

k

y n x n h n x k h n k

y n x k h n k x n h

y n x k h n k

x nh

1

Y HX

X H Y

Page 81: 4 Discrete Time Convolution

Acknowledgement

• Various graphics used here has been taken from public resources instead of redrawing it. Thanks to those who have created it.

• Thanks to:

– Signals and Systems, Haykin & Van Veen

20 January 2011 81