Convolution of two triangular functions

Lindsayyyy
Messages
215
Reaction score
0
Hi everyone, I want to calculate the convolution of two triangluar pulses

Homework Statement


both functions are given by

x(t)=\left\{\begin{array}{ll} t+1, &amp; -1 \leq t \leq 0 \\<br /> 1-t, &amp; 0 \leq t \leq 1 \end{array}\right.

and I rewrote the other as h(-t+t)

Homework Equations



convolution integral



The Attempt at a Solution



So first of all I mirrored my function h(-tau) and then added +t so I have h(-tau+t)

Whenthe front (right) side of my h(-tau+t) is smaller than -1 I have no overlap [1+t<-1] so my integral is zero.
Now I'm not sure about the 2nd part. I think the second part is the following:
when the front of my h(-tau+t) is bigger than -1 but smaller than zero, then these conditions lead to:
1+t>-1 and 1+t<0 so my integration limits are from -1 to 1+t is that correct?

Thanks for your help in advance

Regards Lindsay
 
Physics news on Phys.org
Lindsayyyy said:
Hi everyone, I want to calculate the convolution of two triangluar pulses

Homework Statement


both functions are given by

x(t)=\left\{\begin{array}{ll} t+1, &amp; -1 \leq t \leq 0 \\<br /> 1-t, &amp; 0 \leq t \leq 1 \end{array}\right.

and I rewrote the other as h(-t+t)

Homework Equations



convolution integral



The Attempt at a Solution



So first of all I mirrored my function h(-tau) and then added +t so I have h(-tau+t)

Whenthe front (right) side of my h(-tau+t) is smaller than -1 I have no overlap [1+t<-1] so my integral is zero.
Now I'm not sure about the 2nd part. I think the second part is the following:
when the front of my h(-tau+t) is bigger than -1 but smaller than zero, then these conditions lead to:
1+t>-1 and 1+t<0 so my integration limits are from -1 to 1+t is that correct?

Thanks for your help in advance

Regards Lindsay

If ##w_{+}## denotes the non-negative part of a real number ##w## (that is,
w_{+} = \begin{cases} w &amp;\text{ if } w \geq 0\\<br /> 0 &amp; \text{ if } w &lt; 0<br /> \end{cases}
then you can write your function as ##x(t) = (t+1)_{+} - 2 t_{+} + (t-1)_{+}.## This allows you to split up ##x(\tau) x( t-\tau)## into several terms, each of which is reasonably simple to analyze and itegrate over ##\tau \in (-\infty, \infty)##.
 
I'm not familiar with your technique. We used to solve it by using different sections. Is my approach wrong ?
 
Lindsayyyy said:
I'm not familiar with your technique. We used to solve it by using different sections. Is my approach wrong ?

It is not "my" technique; it is a standard technique, used when dealing with things like splines, etc. It is more-or-less equivalent to what you suggest, but I think it is a lot easier, albeit longer. For example, it is a lot easier to deal with individual terms like
T_1 = \int_{-\infty}^{\infty} (\tau +1)_{+} \cdot (t - \tau + 1)_{+} \: d \tau
than to deal all at once with the total problem. Of course, you still need to split things up into regions, but now each term needs only two regions. For example, in the above we must have ##\tau \geq -1## from the first factor and ##t - \tau \geq -1## from the second factor. So if ##t \leq -2##, both factors are zero for all ##\tau \geq -1##, and so ##T_1 = 0##. If ##t > -2## the ##\tau## integration runs from ##-1## to ##t+1##, so ##T_1 = \int_{-1}^{t+1} (\tau+1)(t-\tau+1) \, d\tau = (t+2)^3/6##. Altogether we have
T_1 = \frac{1}{6} (t+2)_{+}^3.
You can deal with the other 8 terms in a similar way.

OK, it is lengthy, but not excessively difficult.

BTW: a very much easier way than both or ours would be to use Laplace transforms. These essentailly allow one to write the answer almost "by inspection"---of course, after becoming comfortable with Laplace transforms.
 
ok thanks, I don't know if you misunderstood my first post or if I misunderstood you. I never planned to the integration in one step. I wanted to split the integration into different sections (I think there are four).
 
Lindsayyyy said:

The Attempt at a Solution



So first of all I mirrored my function h(-tau) and then added +t so I have h(-tau+t)

Whenthe front (right) side of my h(-tau+t) is smaller than -1 I have no overlap [1+t<-1] so my integral is zero.
Now I'm not sure about the 2nd part. I think the second part is the following:
when the front of my h(-tau+t) is bigger than -1 but smaller than zero, then these conditions lead to:
1+t>-1 and 1+t<0 so my integration limits are from -1 to 1+t is that correct?

Thanks for your help in advance

Regards Lindsay
The limits are fine, but I'm not sure if your reasoning to get there is correct. Is this what you were thinking? The leading "edge" of ##h(t-\tau)## is at ##\tau=t+1##. When it's between ##\tau=-1## and ##\tau=0##, you have the simple overlap of the two regions. This is the condition -1<1+t<0. When this condition holds, then the overlap is from ##\tau=-1## to ##\tau=1+t##, which you can see from a sketch.
 
Ok, after many failed attempts I need your help, I don't understand it.

I know that my h(-tau)=h(tau)

so my h(-tau+t)=h(tau+t)

h(\tau+t)=\left\{\begin{array}{ll} 1+\tau+t, &amp; -1 \leq t \leq 0 \\<br /> 1-\tau+t, &amp; 0 \leq t \leq 1 \end{array}\right.

and my "static" function is

x(\tau)=\left\{\begin{array}{ll} 1+\tau, &amp; -1 \leq t \leq 0 \\<br /> 1-\tau, &amp; 0 \leq t \leq 1 \end{array}\right.

Now I'm not sure how to the convolution. I don't know how to find my different areas (I tried several possibilities). I'm not sure between the two different possibilities:

1.

The first attempt I did was that I said: The front peak of my h(tau+t) function which is 1+t is bigger than -1 but smaller than 0, the integral would like like:

\int \limits_{-1}^{1+t} (1-\tau+t)(1+\tau)d\tau

The second integral is:

\int \limits_{-1}^{0} (1-\tau+t)(1+\tau)d\tau + \int \limits_{0}^{1+t} (1-\tau+t)(1-\tau)d\tau

But the solution I get makes no sense.

2.

The other possibility was the following: the fron peak of h(tau+t) is bigger than -1 but smaller than 1, this leads to

\int \limits_{-1}^{1+t} (1-\tau+t)(1+\tau)d\tau

and afterwards the peak on the left (-1+t) is bigger than -1 but smaller than 1, this leads to

\int \limits_{-1+t}^{1} (1+\tau+t)(1-\tau)d\tau

I don't know, both solutions (I solved it with wolfram) don't make sense to me. Where is my mistake?

Thanks for help everyone
 
Lindsayyyy said:
Ok, after many failed attempts I need your help, I don't understand it.

I know that my h(-tau)=h(tau)

so my h(-tau+t)=h(tau+t)

h(\tau+t)=\left\{\begin{array}{ll} 1+\tau+t, &amp; -1 \leq t \leq 0 \\<br /> 1-\tau+t, &amp; 0 \leq t \leq 1 \end{array}\right.

and my "static" function is

x(\tau)=\left\{\begin{array}{ll} 1+\tau, &amp; -1 \leq t \leq 0 \\<br /> 1-\tau, &amp; 0 \leq t \leq 1 \end{array}\right.

Now I'm not sure how to the convolution. I don't know how to find my different areas (I tried several possibilities). I'm not sure between the two different possibilities:

1.

The first attempt I did was that I said: The front peak of my h(tau+t) function which is 1+t is bigger than -1 but smaller than 0, the integral would like like:

\int \limits_{-1}^{1+t} (1-\tau+t)(1+\tau)d\tau

The second integral is:

\int \limits_{-1}^{0} (1-\tau+t)(1+\tau)d\tau + \int \limits_{0}^{1+t} (1-\tau+t)(1-\tau)d\tau

But the solution I get makes no sense.

2.

The other possibility was the following: the fron peak of h(tau+t) is bigger than -1 but smaller than 1, this leads to

\int \limits_{-1}^{1+t} (1-\tau+t)(1+\tau)d\tau

and afterwards the peak on the left (-1+t) is bigger than -1 but smaller than 1, this leads to

\int \limits_{-1+t}^{1} (1+\tau+t)(1-\tau)d\tau

I don't know, both solutions (I solved it with wolfram) don't make sense to me. Where is my mistake?

Thanks for help everyone

Your first line is wrong. If ##h(\tau) = h(-\tau)## for all ##\tau##, then ##h(-\tau + t) = h(\tau - t)## (unless, maybe, you meant ##h(-(\tau + t))## but carelessly omitted the very important parentheses).

I have already told you how to do the question, but you seem to be determined to do it another way---with no luck so far.
 
Thanks for your help. Well, I don't understand how you explained it to me, that's why I didn't use it, we learned it in a different way than you told me and as you see, I have much trouble even with the way I learned it :( .
Why is h(tau+t)=h(-tau+t) wrong? I thought when h(-tau)=h(t) then I just have to add a t in order to move the triangle

edit: I would give your explanation a shot, but I don't understand it, sorry. It's not like I don't want to hear it, but I thought for the beginning it's easier the way I know it. But your way looks actually easier if you understood the problem. So I wouldn't mind if you'd explain it to me.

It actually starts with the w+ I don't know what you mean with "non negative part of a real number"
Or if you have a good link where I can read about the technique you mentioned, I'd also take that. I need to understand this problem
 
Last edited:
  • #10
Lindsayyyy said:
Why is h(tau+t)=h(-tau+t) wrong?
Because ##\tau+t \ne -\tau+t##. It generally only holds if ##\tau=0##. Your ##h## is an even function, so you can write ##h(t-\tau) = h[-(t-\tau)] = h(\tau-t)##. I don't see how that really helps though.
 
  • #11
Ok, I know my problem now, I don't know which values of h and x get multiplied. I uploaded a picture.

When I convolve do I just multiply the values which are above each other at t (in this picture the yellow line) or do I have to multiply every value (like I marked the two orange ones).


Thanks for your help
 

Attachments

  • kk.png
    kk.png
    4.2 KB · Views: 2,144
  • #12
Lindsayyyy said:
Ok, I know my problem now, I don't know which values of h and x get multiplied. I uploaded a picture.

When I convolve do I just multiply the values which are above each other at t (in this picture the yellow line) or do I have to multiply every value (like I marked the two orange ones).


Thanks for your help

As I have already indicated, you are trying to go too far too fast. You need to split things up into separate terms and look at those in detail. Here we go, one last time (slightly modifying and shortening what I said before).

First some notation: let ##1_{A}(.)## denote the indicator function of a set ##A##; that is,
1_A(w) = \begin{cases} 1 &amp; \text{ if } w \in A\\<br /> 0 &amp; \text{ if } w \not\in A \end{cases}
In this notation we have ##h(t) = (t+1)\, 1_{(-1,0)}(t)+ (1-t)\, 1_{(0,1)}(t)##. Since each h factor has two terms, their product ##h(s) h(t-s)## (using ##s## instead of ##\tau##) consists of four terms:
h(s) h(t-s) = T_1(s,t)+T_2(s,t) +T_3(s,t)+T_4(s,t)
where
T_1(s,t) = (s+1)(t-s+1) \, 1_{(-1,0)}(s) \, 1_{(-1,0)}(t-s)\\<br /> T_2(s,t) = (s+1)(1-t+s) \, 1_{(-1,0)}(s) \, 1_{(0,1)}(t-s)\\<br /> T_3(s,t) = (1-s)(t-s+1) \, 1_{(0,1)}(s) \, 1_{(-1,0)}(t-s)\\<br /> T_4(s,t) = (1-s) (1-t+s) \, 1_{(0,1)}(s) \, 1_{(0,1)}(t-s)<br />
Now let's compute ##H_1(t) = \int_{-\infty}^{\infty} T_1(s,t) \, ds##.

The integrand ##T_1## is nonzero in the region
R_1 = \{ (s,t): -1 \leq s \leq 0, -1 \leq t-s \leq 0 \}
in ##(s,t)##-space. Sketch this region; you need to do it for yourself, because I can't figure out how to attach a drawing easily---nor do I really want to. Anyway, if you do sketch the region ##R_1## you will see that there are two sub-regions in which the limits of the ##s## integration are different. This gives
H_1(t) = 1_{(-2,-1)}(t) \, \int_{s=-1}^{t+1} (s+1)(t-s+1) \, ds <br /> + 1_{(-1,0)}(t) \, \int_{s=t}^0 (s+1)(t-s+1) \, ds
This gives
H_1(t) = 1_{(-2,-1)}(t) \: \frac{1}{6}(t+2)^3 <br /> -1_{(-1,0)}(t) \: \left( \frac{1}{6} t^3 + t^2 + t \right)

The three other integrals can be computed similarly. Some terms will combine, so you will end up with 4 sub-formulas altogether, one for each t-interval (-2,-1), (-1,0), (0,1) and (1,2).
 
Last edited:
  • #13
Lindsayyyy said:
Ok, I know my problem now, I don't know which values of h and x get multiplied. I uploaded a picture.

When I convolve do I just multiply the values which are above each other at t (in this picture the yellow line) or do I have to multiply every value (like I marked the two orange ones).
The horizontal axis is ##\tau##, not ##t##. The value of ##t## specifies how much you shift the function along the ##\tau## axis. Either the blue or red graph is not correct. One should be centered around ##\tau=0##. It looks like you shifted both x and h.

Ignoring that detail for now, you should realize that the green curve represents the integrand as a function of ##\tau##, so the integral represents the area under curve. That would be the value of the convolution for a given value of ##t##.
 
  • #14
Thanks to both to you, I have to go to the university soon, I'll take a closer look at yours then Ray.

@Vela, I should have mentioned, that I found this Applet online, that's why both triangle looks shifted. But it's not clear to me where I have to multiply the functions.
 
  • #15
Well, I'm too stupid to understand your approach Ray Vickson, thanks anyways.

I calculated my first integral now and come to the same solution you go Ray

\int \limits_{-1}^{1+t} (1-\tau+t)(1+\tau) d\tau = \frac 1 6 (t+2)^3

but I have difficulties in the interval where t is bigger than -1 but smaller than 0

I got:

\int (1+\tau+t)(1+\tau) d\tau + \int (1-\tau+t)(1+\tau) d\tau + \int\limits_{0}^{1+t} (1-\tau+t)(1-\tau) d\tau

I left out the first 4 limits for the first 2 integrals because I don't know them, I tried everything but I failed. I know that the whole integral has to be the value 1/6 when I solved it for t=-1 but I don't get it. Where's the mistake?

I'm literally sitting here for four hours and I'm stupid to solve this problem.
Thanks for your help guys
 
  • #16
Let's try calculate the convolution
$$\int_{-\infty}^\infty x(\tau)h(t-\tau)\,d\tau$$ for a specific value of ##t##, say, ##t=-3/4##. I've attached a plot of ##x(\tau)## and ##h(t-\tau)## for t=-3/4. You can see that ##x(\tau)## divides the number line into four regions: (-∞,-1), (-1,0), (0,1), and (1,∞). Similarly, ##h(\tau)## divides the number line into four regions: (-∞, -7/4), (-7/4, -3/4), (-3/4, 1/4), and (1/4, ∞). On the second image, I plotted the points corresponding to the interval boundaries. The blue dots correspond to the intervals for ##x##, and the red dots, to intervals for ##h##. You can see the points split the number line into of seven different intervals.

For ##\tau<-1## and ##\tau>1/4##, ##x(\tau)=0## or ##h(\tau)=0##, so the integrand is 0. That takes care of four out of the seven intervals.

For ##-1 < \tau < -3/4##, ##x(\tau) = 1+\tau##. The argument of ##h##, ##-3/4-\tau##, will be positive, so ##h(-3/4-\tau) = 1-(-3/4-\tau) = 7/4+\tau##. So the first integral will be
$$\int_{-1}^{-3/4} (1+\tau)(7/4+\tau)\,d\tau.$$
For ##-3/4 < \tau < 0##, ##x(\tau)## still equals ##1+\tau##. The argument of ##h##, however, is now negative, so ##h(-3/4-\tau) = 1+(-3/4-\tau) = 1/4-\tau##. The next integral will be
$$\int_{-3/4}^{0} (1+\tau)(1/4-\tau)\,d\tau.$$
Finally, we have to consider ##0<\tau<1/4##. In this case, ##x(\tau) = 1-\tau## and ##h(-3/4-\tau) = 1+(-3/4-\tau) = 1/4-\tau##, and you get
$$\int_{0}^{1/4} (1-\tau)(1/4-\tau)\,d\tau.$$ Putting it all together, you have
$$\int_{-\infty}^\infty x(\tau)h(-3/4-\tau)\,d\tau = \int_{-1}^{-3/4} (1+\tau)(7/4+\tau)\,d\tau + \int_{-3/4}^{0} (1+\tau)(1/4-\tau)\,d\tau + \int_{0}^{1/4} (1-\tau)(1/4-\tau)\,d\tau.$$
This was for a specific value of ##t##. You need to generalize this for any value of ##t##. You'll want to consider two cases: ##-1<t<0## and ##0<t<1##. For other values of ##t##, the convolution is 0.
 

Attachments

  • #17
Ok thanks, I try it tomorrow, I tried it now, but I can't concentrate anymore. Thank you very much.
 

Similar threads

Back
Top