1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Convolution of two triangular functions

  1. Jan 29, 2014 #1
    Hi everyone, I want to calculate the convolution of two triangluar pulses

    1. The problem statement, all variables and given/known data
    both functions are given by

    [tex] x(t)=\left\{\begin{array}{ll} t+1, & -1 \leq t \leq 0 \\
    1-t, & 0 \leq t \leq 1 \end{array}\right. [/tex]

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

    2. Relevant equations

    convolution integral



    3. 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
     
  2. jcsd
  3. Jan 29, 2014 #2

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    If ##w_{+}## denotes the non-negative part of a real number ##w## (that is,
    [tex] w_{+} = \begin{cases} w &\text{ if } w \geq 0\\
    0 & \text{ if } w < 0
    \end{cases} [/tex]
    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)##.
     
  4. Jan 29, 2014 #3
    I'm not familiar with your technique. We used to solve it by using different sections. Is my approach wrong ?
     
  5. Jan 29, 2014 #4

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    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
    [tex]T_1 = \int_{-\infty}^{\infty} (\tau +1)_{+} \cdot (t - \tau + 1)_{+} \: d \tau [/tex]
    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
    [tex] T_1 = \frac{1}{6} (t+2)_{+}^3.[/tex]
    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.
     
  6. Jan 29, 2014 #5
    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).
     
  7. Jan 29, 2014 #6

    vela

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Education Advisor

    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.
     
  8. Feb 3, 2014 #7
    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)

    [tex] h(\tau+t)=\left\{\begin{array}{ll} 1+\tau+t, & -1 \leq t \leq 0 \\
    1-\tau+t, & 0 \leq t \leq 1 \end{array}\right. [/tex]

    and my "static" function is

    [tex]x(\tau)=\left\{\begin{array}{ll} 1+\tau, & -1 \leq t \leq 0 \\
    1-\tau, & 0 \leq t \leq 1 \end{array}\right. [/tex]

    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:

    [tex] \int \limits_{-1}^{1+t} (1-\tau+t)(1+\tau)d\tau [/tex]

    The second integral is:

    [tex] \int \limits_{-1}^{0} (1-\tau+t)(1+\tau)d\tau + \int \limits_{0}^{1+t} (1-\tau+t)(1-\tau)d\tau [/tex]

    But the solution I get makes no sense.

    2.

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

    [tex] \int \limits_{-1}^{1+t} (1-\tau+t)(1+\tau)d\tau [/tex]

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

    [tex] \int \limits_{-1+t}^{1} (1+\tau+t)(1-\tau)d\tau [/tex]

    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
     
  9. Feb 3, 2014 #8

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    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.
     
  10. Feb 3, 2014 #9
    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: Feb 3, 2014
  11. Feb 3, 2014 #10

    vela

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Education Advisor

    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.
     
  12. Feb 3, 2014 #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
     

    Attached Files:

    • kk.png
      kk.png
      File size:
      4.7 KB
      Views:
      548
  13. Feb 3, 2014 #12

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    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,
    [tex] 1_A(w) = \begin{cases} 1 & \text{ if } w \in A\\
    0 & \text{ if } w \not\in A \end{cases}[/tex]
    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:
    [tex] h(s) h(t-s) = T_1(s,t)+T_2(s,t) +T_3(s,t)+T_4(s,t) [/tex]
    where
    [tex] T_1(s,t) = (s+1)(t-s+1) \, 1_{(-1,0)}(s) \, 1_{(-1,0)}(t-s)\\
    T_2(s,t) = (s+1)(1-t+s) \, 1_{(-1,0)}(s) \, 1_{(0,1)}(t-s)\\
    T_3(s,t) = (1-s)(t-s+1) \, 1_{(0,1)}(s) \, 1_{(-1,0)}(t-s)\\
    T_4(s,t) = (1-s) (1-t+s) \, 1_{(0,1)}(s) \, 1_{(0,1)}(t-s)
    [/tex]
    Now let's compute ##H_1(t) = \int_{-\infty}^{\infty} T_1(s,t) \, ds##.

    The integrand ##T_1## is nonzero in the region
    [tex] R_1 = \{ (s,t): -1 \leq s \leq 0, -1 \leq t-s \leq 0 \} [/tex]
    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
    [tex] H_1(t) = 1_{(-2,-1)}(t) \, \int_{s=-1}^{t+1} (s+1)(t-s+1) \, ds
    + 1_{(-1,0)}(t) \, \int_{s=t}^0 (s+1)(t-s+1) \, ds [/tex]
    This gives
    [tex] H_1(t) = 1_{(-2,-1)}(t) \: \frac{1}{6}(t+2)^3
    -1_{(-1,0)}(t) \: \left( \frac{1}{6} t^3 + t^2 + t \right)[/tex]

    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: Feb 3, 2014
  14. Feb 3, 2014 #13

    vela

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Education Advisor

    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##.
     
  15. Feb 4, 2014 #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.
     
  16. Feb 4, 2014 #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

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

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

    I got:

    [tex] \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 [/tex]

    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
     
  17. Feb 4, 2014 #16

    vela

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Education Advisor

    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.
     

    Attached Files:

  18. Feb 4, 2014 #17
    Ok thanks, I try it tomorrow, I tried it now, but I can't concentrate anymore. Thank you very much.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Convolution of two triangular functions
Loading...