# Homework Set 3 Solutions

date post

08-Nov-2014Category

## Documents

view

117download

3

Embed Size (px)

### Transcript of Homework Set 3 Solutions

1

EE102 Fall Quarter 2010

Systems and Signals Jin Hyung Lee

Homework #3 Solutions Due: Wednesday, October 20, 2010 at 5 PM. 1. It is often useful to represent operations on signals as convolutions. For each of the following, nd a function h(t) such that y (t) = (x h)(t).t

(a) y (t) =

x( ) d

Solution: We want to nd an h(t) so thatt

y (t) =

x( ) d x( )h(t )d

=

From the lecture notes, if h(t) was causal, the upper limit of the convolution would be t. In addition, we want h(t) to be of unit amplitude, so that we get x( ) when we multiply by h(t ). This means that h(t) = u(t), since h(t) is one for positive time, and zero for negative time. Then

y (t) =

u( )u(t )d

= (x u)(t). where u(t) is the unit step. We conclude that y (t) = (x h)(t) with h(t) = u(t).

h(t ) = u(t ) 1

tt

(b) y (t) =

x( ) dtT t

Solution: y (t) =t1 t

x( ) dtT

=

x( ) d

x( ) d

= (x h0 )(t) (x hT )(t)

2

where h0 (t) = u(t) is the unit step, as in (a), and hT (t) = u(t T ) is the unit step delayed by T . Then y (t) = (x (h0 hT ))(t) = (x h)(t) where h(t) = h0 (t) hT (t) = u(t) u(t T ). This is a square pulse of of amplitude 1, tha goes from time zero to T .h(t) = u(t) u(t T )

1

T

0

T

2T

t

(c) y (t) = x(t) Solution: Here we want a convolution system that simply returns the input

y (t) =

x( )h(t )d

If h(t) is an an impulse function,

y (t) =

x( ) (t )d = x(t)

by the sifting property. So h(t) = (t). (d) y (t) = x(t 1) Solution: delayed,

This will be similar to (c), with an addition that the output should be

y (t) =

x( )h(t )d

If we let h(t) be a delayed impulse (t 1), then

y (t) =

x( ) ((t ) 1)d =

x( ) ((t 1) ) 1)d = x(t 1)

again by the sifting property. So h(t) = (t 1). 2. Graphically compute the convolution of these two functions:2 1 -1 0 1 22

f (t )3 t-1

g(t )

1 0 1 2 3 t

3

Solution: The convolution can be graphically performed by ipping f about the origin, shifting it right by t, multiplying point by point with g (t), and then evaluating the area. At time t = 0 there is no overlap, and the output is zero. The rst overlap begins at t = 2, so this is the rst output point. The area of the overlap ist 2

4( 2)d = (1/2)(t 2)(4(t 2)) = 2(t 2)2

for 2 < t < 3. This is a smoothly increasing quadratic. over this interval, which reaches a peak amplitude of 2 at t = 3. From t = 3 to t = 4, the area of the overlap starts to decrease slowly, as the initial part of the triangle no longer overlaps the rectangle. The rate at which we loose area is exactly the same as the rate we gained area from t = 2 to t = 3, so the result is the same shape, but inverted. We get a smooth, quadratic signal, concave down, that starts at an amplitude of 2 at t = 3 , and goes to 0 at t = 4, when the triangle and the rectangle no longer overlap. These breakpoints are illustrated below:f (0 )2 1 -1 0 1 2 3 t

g() t =0-1

2 1 g() 0 1 2

f (3 )3 t

t =3

2 1 -1 0

f (2 )

g() t =2

2 1 g() -1 0 1 2

f (3.5 ) t = 3.53 t

1

2

3 t

2 1 -1 0

f (2.5 )

g() t = 2.5

2 1 g() -1 0 1 2

f (4 ) t =43 t

1

2

3 t

The result is2 1 -1 0 1 2 3 4 5( f g)(t )

t

3. Analytically compute the convolution (f g )(t), where f (t) and g (t) are f (t) = u(t)et g (t) = rect(t)

4

and sketch a plot of the result. Solution There are several ways to do this. The most direct, is to write out the convolution integral

(f g )(t) = =

0

e u( )rect(t )d e rect(t )d

If t < 1/2, the rect() is completely to the left of the origin, and the integral is zero. If 1/2 < t < 1/2 the rect() overlaps the origin, and the limits of the integral are from 0 to t+1/2t+1/2

(f g )(t) =

0

e d = e

t+1/2 0

= 1 e(t+1/2)

If t > 1/2, then the rect() is to the right of the origin, andt+1/2

(f g )(t) =

t1/2

e d = e

t+1/2 t1/2

= e(t1/2) e(t+1/2) = et (e1/2 e1/2 ).

This is plotted below.0.7 0.6 0.5 Amplitude 0.4 0.3 0.2 0.1 0 2 1 0 1 2 Time 3 4 5

4. Show the somewhat surprising result that the convolution of two impulse functions,

y (t) =

( ) (t ) d

is itself an impulse function. Hint: To make sense of the integral, rst replace one of the impulses with lim g (t), where 0 g (t) is 1/ |t| < /2 g (t) = 0 otherwise This is a model for an impulse function, as we discussed in class. After the convolution, show you get the same model function back.

5

Solution: To gure out what y (t) =

( ) (t ) d

means, we have to deal with the impulse functions carefully. Remember from class that one of the expressions that makes no sense with impulses is 2 (t), and this is what we have here for t = 0! To understand what this integral means we replace ( ) with lim g (t), and 0 then evaluate the integral

y (t) =

( ) (t ) d0

=

lim g ( ) (t )d g ( ) (t )d

= lim

0 0

= lim g (t) = (t). where we can evaluate the last integral using the sifting property of impulse functions, since g ( ) is a conventional function for any given . Hence, we get the surprising result that ( )(t) = (t) 5. The derivative of a function x(t) may be written as the convolution x (t) = (x )(t), where (t) is the derivative of (t). If f g = y , show that f g =y . (hint: try to use properties of convolution) Solution: Convolution is commutative and associative, and so we can group the differentiation with either f , g , or f g = y , f g = (f ) (g ) = f g = (f g ) = (f g ) = y 6. The output of this system y (t) is a convolution of the input x(t) and an impulse response h(t). Find a simple expression for the impulse response h(t). Simplify the expression so that it doesnt contain any explicit convolutions.

x(t )

d dt

g(t )

(t 1)

y(t )

6

Solution We can write the overall impulse response as the convolution of the individual impulse responses. The derivative operation is a convolution with (t), so h(t) = ( (t)) (g (t)) ( (t 1)) = (g (t)) ( (t 1)) = g (t 1) where we have used the fact that convolution with (t 1) is a delay by 1.

7

Matlab Assignment #2This laboratory will be concerned with numerically evaluating continuous time convolution integrals. Matlab provides a function conv() that performs a discrete-time convolution of two discrete-time sequences. We will add a new function to matlab that uses conv() to numerically integrate the continuous time convolution. To do this, well need to learn about how to dene new functions in matlab. Matlab provides two ways of executing commands that you have programmed in a le. Both are stored in a .m le or m-le. This rst is a script. Invoking the script at the command line causes the le to be treated as terminal input in your current matlab environment. Most of the examples in the book are matlab scripts. Variables created in the script are visible when it completes, and the script has access to all of the variables that have been dened in your work space. Because it can modify your workspace, this is not a good way to implement extentions to matlab. The second option is to dene a function in the m-le. In this case, the function operates in its own local context. It doesnt have access to variables in your workspace, only to the function arguments which are are passed by value. Only the returned values are available to the calling function, and these are also passed by value. Hence, function m-les are a much more robust way to encapsulate repeated operations. As an example, lets say you want to be able to compute the average value of some vector. A function m-le that does this is function a = avg(v) % % Anything you type here is printed when you enter "help avg" % at the matlab prompt. Good things to put here are a description % what the function does, the calling arguments and the % return values. % % a = avg(v) % Inputs: % v -- vector % outputs: % a -- average value of the elements in v % % at last, the actual code % compute the mean a = sum(v)/length(v); Store this in a le avg.m either in your current directory, or somewhere in your matlab path (help path and help addpath for more information). Any time you enter avg() at the com-

8

mand prompt, this function will be invoked. Any other m-le can also call it. From then on, it will appear as though this function was actually a built-in component of matlab. In fact, many of the functions in matlab are function m-les. We can also return more than one value. Here we return the mean and the median, function [a, m] = avg_med(v) % % Anything you type here is printed when you enter "help avg" % at the matlab prompt. Good things to put here are a description % what the function does, and the calling arguments and % and return arguments. % % a = avg_med(v) % Inputs: % v -- vector % outputs: % a -- average value of the elements in v % m -- median value of the elements in v % % the actual code % compute the mean a = sum(v)/length(v); % sort the data, take the middle value vs = sort(v); m = v(floor((length(v)+1)/2));

If we invoke avg_med with one return argument >> a = avg_med(v) only the average is returned, as before. If we provide two return arguments, we get the average and the median. >> [a, m] = avg_med(v) In the rst lab we talked about using vect