Question about convolution.

Thread Starter

wiz0r

Joined May 2, 2008
64
Ok, I am supposed to find the convolutions of the following functions;

x1(t) = t*u(t) - t*u(t-1);
x2(t) = (10*exp(-4*t))*u(t);

by hand. So, I did it and I found out that;

x1(t)*x2(t) = ((5/8)*exp(-4*t) + (5/2)*t - (5/8))*u(t) - ((5/8)*exp(-4*t) + (5/2)*t - (5/8))*u(t-1)

Now, I have to plot it with MATLAB, so I did it(attachment 1). And I have to compare it to the plot given by MATLAB's conv function(attachment 2).

As you can see the plots are similar, but they have their obvious differences. Why does my first plot go to zero as soon as it reaches one? And the other decreases exponentially? I still can't figure out why, so please help me. ;<

The code to find the conv that I found by hand is here;

Rich (BB code):
syms t
t = 0:.001:4;
y = ((5/8).*exp(-4.*t) + (5/2).*t - (5/8)).*Heaviside(t) - ((5/8).*exp(-4.*t) + (5/2).*t - (5/8)).*Heaviside(t-1)
plot(t,y)
And the code to find the conv of the two functions with MATLAB is here;

Rich (BB code):
syms t
t = 0:.001:2;
tconv = 0:.001:4;
x1 = t.*Heaviside(t) - t.*Heaviside(t-1); 
x2 = (10*exp(-4*t)).*Heaviside(t);
y = conv(x1, x2);
plot(tconv,y)
PS: Heaviside(t) works like u(t).

Edwin
 

Attachments

Thread Starter

wiz0r

Joined May 2, 2008
64
I took the laplace transform of x1(t) and x2(t).

x1(s) = (1/s^2)(1 - e^-s)
x2(s) = 10/s+4

then, I multiplied them both, and I get

x(s) = 10/(s^2 * (s+4)) (1-e^-s);

then I found the inverse laplace transform of x(s) to find x(t). that's correct, right?
 

steveb

Joined Jul 3, 2008
2,436
I don't have time to look at the details of this as I'm packing to go on a trip, but I noticed something.

When I look at x1 it appears to be a ramp until t=1 and then is constant with a value of one after that, and x2 is a simple decaying exponential. Both functions are zero for x<0. So in the limit at t goes to infinity, I expect the convolution of these two signals to approach a non zero constant equal to the integral of x2 from zero to infinity. Just working this out quickly, the constant should be 5/32.

Hopefully, I'm thinking about this correctly - see if you agree. If I'm right, then both of those plots are wrong. Or, maybe I'm just tired and am way off base.

Edited P.S.
Actually, I just rechecked your second plot. The scale is such that the exponential could be approaching 5/32, and just appears to approach zero. So maybe that second plot is correct; although I'm surprised the magnitude is so high - so, i'm still suspicious.
 

blazedaces

Joined Jul 24, 2008
130
I don't have time to look at the details of this as I'm packing to go on a trip, but I noticed something.

When I look at x1 it appears to be a ramp until t=1 and then is constant with a value of one after that, and x2 is a simple decaying exponential. Both functions are zero for x<0. So in the limit at t goes to infinity, I expect the convolution of these two signals to approach a non zero constant equal to the integral of x2 from zero to infinity. Just working this out quickly, the constant should be 5/32.

Hopefully, I'm thinking about this correctly - see if you agree. If I'm right, then both of those plots are wrong. Or, maybe I'm just tired and am way off base.

Edited P.S.
Actually, I just rechecked your second plot. The scale is such that the exponential could be approaching 5/32, and just appears to approach zero. So maybe that second plot is correct; although I'm surprised the magnitude is so high - so, i'm still suspicious.
It's minus u(t-1) so x1 is a ramp from 0 until 1, otherwise it's 0. Since x2 approaches 0, so should the convolution of both...

And wizor... I don't know. That sounds like it ... should make sense... but it just doesn't for some reason. Just thinking about it, the convolution of those two signals does not go only between 0 and 1...

Why not try straightforward convolution in the time domain?

-blazed
 

steveb

Joined Jul 3, 2008
2,436
It's minus u(t-1) so x1 is a ramp from 0 until 1, otherwise it's 0. Since x2 approaches 0, so should the convolution of both...
Yes, of course. I'm too tired I guess. :) Sorry, I couldn't put more time in on this. I'm packing for an early morning flight.
 

steveb

Joined Jul 3, 2008
2,436
Ok, so I just packed and have a few minutes to try this. I'm rusty and tired, so maybe I made another mistake. Anyway, I got the following result for the convolution.

\( x_1 * x_2 = {{5}\over{8}}e^{-4t}[(e^{4t}(4t-1)+1)(u(t)-u(t-1))+(3e^4+1)u(t-1)] \)
 

Attachments

Last edited:

blazedaces

Joined Jul 24, 2008
130
Ok, so I just packed and have a few minutes to try this. I'm rusty and tired, so maybe I made another mistake. Anyway, I got the following result for the convolution.

\( x_1 * x_2 = {{5}\over{8}}e^{-4t}[(e^{4t}(4t-1)+1)(u(t)-u(t-1))+(3e^4+1)u(t-1)] \)
And using the method of taking the laplace transform, multiplying them, then taking the inverse laplace I get the following:

\({{5}\over{2}}tu(t)-{{5}\over{8}}u(t)+{{5}\over{8}}e^{-4t}u(t)-{{5}\over{2}}(t-1)u(t-1)-{{15}\over{8}}u(t-1)+{{15}\over{8}}e^{-4(t-1)}u(t-1)\)

I'm not going to simplify it further, but a quick glance and you can see they match.

Wizor, you made a mistake in taking the laplace transform of x1(t). First of all, the laplace transform of f1(t)*f2(t) IS NOT equal to the laplace transform of f1(t) * the laplace transform of f2(t). I don't know if that's your mistake... or ...

if you tried to take the laplace transform of t*u(t-1) and thought it equaled \({{1}\over{s^{2}}}e^{-s}\)...

See, this particularly property states that if you have a shift in the time domain, as in f(t-k), then in the laplace domain your function is \(F(s)*e^{-ks}\). So, t*u(t-1) is not a function of (t-1). In order to take the proper laplace transform of it, you should turn it into a function of (t-1). So you have to think, (t-1)*u(t-1) + something = t*u(t-1).

Does this make sense? Try it again. Whichever method is more comfortable for you. And don't be discouraged. I was making the same mistake and couldn't figure out what was wrong for a while either... Good luck,

-blazed
 

Thread Starter

wiz0r

Joined May 2, 2008
64
Yes, my error was that I though that the laplace transform of t*u(t-1) equaled
.

So, that was my error. Right now I'm in class, so I can't fix anything, but I will as soon as I get home.

I must say that I'm thankful, steve. You helped me even though you were leaving for a trip. So, I want to say, thank you. Hope you have an awesome trip! :)

Also, thanks a lot blazed, again, hehe. Thanks for the long and clear explanation of my problem.

Thank you both,
Edwin
 

Thread Starter

wiz0r

Joined May 2, 2008
64
Woot, after fixing the laplace transform, and everything I got that;

x1(t)*x2(t) = (((5/8)*exp(-4*t)) + 2.5*t - 0.625)*u(t) - (-((15/8)*(exp( -4*t)*exp(4))) + (5/2)*t - (5/8))*u(t-1)

So, I plotted the convolution and everything worked fine(you can see it in the attachment).

So, once more, thank you guys. :]

Edwin
 

Attachments

steveb

Joined Jul 3, 2008
2,436
Yes, that looks correct. Good work.

It's funny, I decided to work on this on my plane trip. I did the problem in both the time domain and the s-domain just to make sure it was correct. I attached the work, but I guess it's too late.:):

Anyway, it made the trip go by much faster, and it never hurts to brush up on this stuff. ;)
 

Attachments

Thread Starter

wiz0r

Joined May 2, 2008
64
Wow, steve that's some awesome stuff. Thanks, man. :)

It helped me to verify the problem, and I'm happy to say that everything looks good.

Thanks for taking some time to help me.

Edwin
 
Top