Convolution Calculation (piecewise function)

In summary, the convolution of the functions f(t) and h(t) is given by the integral from -1 to 1 of the function h(t - tau), where tau ranges from t - 1 to t + 1 and the function h(t) is zero outside of the interval [-0.5, 0.5].
  • #1
roam
1,271
12

Homework Statement


Compute the convolution ##(f*h)(t)## where

$$f(t) = \left\{\begin{matrix}1, \ \ for \ \ |t|<1 \\ 0, \ \ \ \ otherwise \end{matrix}\right.$$

and

$$h(t) = \left\{\begin{matrix}2|t|-1, \ \ for \ \ |t|<1/2 \\ 0, \ \ \ \ otherwise \end{matrix}\right.$$

Homework Equations



Convolution integral: ##(f*h)(t)= \int^\infty_{-\infty} f(\tau) h(t-\tau) d \tau##

The Attempt at a Solution


[/B]
Here I first made a sketch of the two functions:

plot.jpg


f(t) is non-zero on [-1, 1] and g(t) is non-zero on [-0.5, 0.5], so adding these two we find that (f ∗ g)(t) should be nonzero on [-1.5, 1.5]. The list of change points of (f ∗ g)(t) is {-1.5, -0.5, 0.5, 1.5}. For values t that are outside this range the convolution is zero.

So, do I need to calculate the convolution for 3 separate cases?

I mean ##-1.5 \leq t \leq -0.5##, ##-0.5 \leq t \leq 0.5##, and ##0.5 \leq t \leq 1.5##?

Here is my attempt:

First case: we want to integrate from -1.5 to -0.5 using the formula given above (##(f*g)(t)=\int^{0.5}_{-1.5} f(\tau) h(t-\tau) d \tau##). ##h(t)## is zero. But for ##f(t)## the function is zero on the interval ##(-1.5, -1)##, whereas it is equal to 1 from ##(-1, -0.5)##, so what value do I need to be using for the function? :confused:

Any help is greatly appreciated.
 
Physics news on Phys.org
  • #2
roam said:

Homework Statement


Compute the convolution ##(f*h)(t)## where

$$f(t) = \left\{\begin{matrix}1, \ \ for \ \ |t|<1 \\ 0, \ \ \ \ otherwise \end{matrix}\right.$$

and

$$h(t) = \left\{\begin{matrix}2|t|-1, \ \ for \ \ |t|<1/2 \\ 0, \ \ \ \ otherwise \end{matrix}\right.$$

Homework Equations



Convolution integral: ##(f*h)(t)= \int^\infty_{-\infty} f(\tau) h(t-\tau) d \tau##

The Attempt at a Solution


[/B]
Here I first made a sketch of the two functions:

plot.jpg


f(t) is non-zero on [-1, 1] and g(t) is non-zero on [-0.5, 0.5], so adding these two we find that (f ∗ g)(t) should be nonzero on [-1.5, 1.5]. The list of change points of (f ∗ g)(t) is {-1.5, -0.5, 0.5, 1.5}. For values t that are outside this range the convolution is zero.

So, do I need to calculate the convolution for 3 separate cases?

I mean ##-1.5 \leq t \leq -0.5##, ##-0.5 \leq t \leq 0.5##, and ##0.5 \leq t \leq 1.5##?

Here is my attempt:

First case: we want to integrate from -1.5 to -0.5 using the formula given above (##(f*g)(t)=\int^{0.5}_{-1.5} f(\tau) h(t-\tau) d \tau##). ##h(t)## is zero. But for ##f(t)## the function is zero on the interval ##(-1.5, -1)##, whereas it is equal to 1 from ##(-1, -0.5)##, so what value do I need to be using for the function? :confused:

Any help is greatly appreciated.
If ##f## is zero on an interval, the integral simply vanishes there. Then you get:
##(f*h)(t)=\displaystyle \int^{+ \infty}_{-\infty} f(\tau) h(t-\tau) d \tau = \int^{1}_{-1} h(t-\tau) d \tau##.

(EDIT: I had written ##(f*g)(t)## instead of ##(f*h)(t)##, typo now corrected.)
 
Last edited:
  • Like
Likes roam
  • #3
To add to my previous post:

I would consider a substitution ##\sigma =t- \tau##.
Also notice that both ##f## and ##h## are even functions, so their convolution will also be an even function.
Finally, when you distinguish between the different relevant cases for ##t## (ie ##t\leq -1.5##, ##-1.5 \leq t \leq -1##, ##-0.5 \leq t \leq 0##), the results you obtain for each of the segments must be equal on their mutual endpoints.

EDIT: the relevant cases were meant to be ##t\leq -1.5##, ##-1.5 \leq t \leq -1##, ##-1 \leq t \leq -0.5##, ##-0.5 \leq t \leq 0##
 
Last edited:
  • Like
Likes roam
  • #4
Thank you Samy for your response.

For the case ##-1.5 \leq t \leq -0.5##, could you please explain how you got the integral limits to be ##(-1,1)## instead of ##(-1.5, -0.5)##?

I think alternatively it is also possible to rewrite the integral limits like:

$$t+0.5 \leq \tau \leq t+1.5$$

In the interval ##[-1.5, -0.5]##, ##x+0.5## is between -1 and 0. Whereas ##x+1.5## is between 0 and 1. So the integral can be rewritten:

$$(f*h)(t)=\int^{t+1.5}_{t+0.5} h(t- \tau) \ d \tau$$

I am not sure how to proceed from here. How exactly does a substitution help? (this is my first convolution problem of this type)

Samy_A said:
Finally, when you distinguish between the different relevant cases for ##t## (ie ##t\leq -1.5##, ##-1.5 \leq t \leq -1##, ##-0.5 \leq t \leq 0##), the results you obtain for each of the segments must be equal on their mutual endpoints.

But shouldn't the three cases be the following?

(i) ##-1.5 \leq t \leq -0.5##

(ii) ##-0.5 \leq t \leq 0.5##

(iii) ##0.5 \leq t \leq 1.5##

For values of t less than -1.5 or greater than 1.5, (f∗g)(t) is zero.
 
  • #5
roam said:
Thank you Samy for your response.

For the case ##-1.5 \leq t \leq -0.5##, could you please explain how you got the integral limits to be ##(-1,1)## instead of ##(-1.5, -0.5)##?
I wasn't considering cases yet.

I simply started from the definition: ##\displaystyle (f*h)(t)=\displaystyle \int^{+ \infty}_{-\infty} f(\tau) h(t-\tau) d \tau##.
Since ##f## is 0 outside of ##[-1,1]##, the integration limits can be replaced by ##-1## and ##+1##.
Since ##f## is 1 in ##[-1,1]##, the ##f(\tau)## just becomes ##1##, giving the result: ##\displaystyle (f*h)(t)=\displaystyle \int^{+1}_{-1} h(t-\tau) d \tau##.
roam said:
I think alternatively it is also possible to rewrite the integral limits like:

$$t+0.5 \leq \tau \leq t+1.5$$

In the interval ##[-1.5, -0.5]##, ##x+0.5## is between -1 and 0. Whereas ##x+1.5## is between 0 and 1. So the integral can be rewritten:

$$(f*h)(t)=\int^{t+1.5}_{t+0.5} h(t- \tau) \ d \tau$$

I am not sure how to proceed from here. How exactly does a substitution help? (this is my first convolution problem of this type)
But shouldn't the three cases be the following?

(i) ##-1.5 \leq t \leq -0.5##

(ii) ##-0.5 \leq t \leq 0.5##

(iii) ##0.5 \leq t \leq 1.5##

For values of t less than -1.5 or greater than 1.5, (f∗g)(t) is zero.
I made a mistake in listing the cases, sorry for that.

It really depends on how you want to tackle the integral. (There are probably a number of ways to do it, I'm not sure the one I suggest is the shortest.)

I suggested the substitution ##\sigma =t-\tau##.
The integral then becomes ##\displaystyle (f*h)(t)=\displaystyle -\int^{t+1}_{t-1} h(\sigma) d \sigma \ \ \ \ (1)##.
(There is no deep reason for this substitution. I think that dealing with ##h(\sigma)## is less error prone than dealing with ##h(t-\tau)## when treating the different cases.)
Notice that ##h## vanishes outside of ##[-0.5,+0.5]##, and that the expression for ##h## is different for positive and negative ##\sigma##. This will be important when treating the various cases.

Now for the cases.
a) For ##t\leq -1.5##, the convolution is 0, as you already wrote.

b) For ##-1.5 \leq t \leq -1##, the integration limits will be ##-0.5 \to t+1 (\leq 0)##, so you can use the expression for ##h## as valid for negative ##\sigma##.

c) For ##-1 \leq t -0.5##, the integration limits will be ##-0.5 \to t+1##, where ##0 \leq t+1 \leq 0.5##. In this case the integral (1) will consist of two parts: the integral from ##-0.5## to ##0## and the integral from ##0## to ##t+1## (with different expressions for ##h(\sigma)##).

d) For ##-0.5 \leq t \leq 0##, the integration limits will be ##-0.5 \to 0.5##, and the integral will also consist of two parts (##-0.5 \to 0, 0 \to 0.5##).
Since ##h## is even and the integration domain is symmetric around the y-axis, you can compute one of the integrals and multiply the result by 2.

e) Finally, for ##t \geq 0##, make use of the fact that ##f*h## is an even function, and use (with the needed precautions) the results obtained for negative ##t##.
 
Last edited:
  • Like
Likes roam
  • #6
Thank you for the explanation. Yes ##h## is ##-2t-1## for negative σ. So, for instance for the case ##-1.5 \leq t \leq -1## this is what I found:

$$(f*h)(t) = -\int^{t+1}_{-0.5} h(\sigma) d \sigma = -\int^{t+1}_{-0.5} (-2t-1) \ dt = - \left( (t+1)^2 -(t+1)-0.25 \right)$$

Is this correct?

This function looks like an inverted parabola. This is the region of interest:

graph.jpg


I just want to make sure it is done correctly so I can calculate the other integrals, and sketch ##(f*h)(t)## to make sure it is an even symmetric function.
 
  • #7
roam said:
Thank you for the explanation. Yes ##h## is ##-2t-1## for negative σ. So, for instance for the case ##-1.5 \leq t \leq -1## this is what I found:

$$(f*h)(t) = -\int^{t+1}_{-0.5} h(\sigma) d \sigma = -\int^{t+1}_{-0.5} (-2t-1) \ dt = - \left( (t+1)^2 -(t+1)-0.25 \right)$$

Is this correct?
I find something different.
If I'm not mistaken, your function is equal to -0.5 in -1.5. That should be 0.

Your integral is the same as mine for that case, but the result is different.
When I computed the convolution this morning, I had a number of sign errors. It looks like that's what you have here too.
 
Last edited:
  • Like
Likes roam
  • #8
Samy_A said:
I find something different.
If I'm not mistaken, your function is equal to -0.5 in -1.5. That should be 0.

Your integral is the same as mine for that case, but the result is different.
When I computed the convolution this morning, I had a number of sign errors. It looks like that's what you have here too.

Oops, I did the integral again and there was a sign error as you suggested:

$$- \int^{t+1}_{-0.5} (-2t-1).dt = -\Bigg[ \frac{-2 t^2}{2} -t \Bigg]^{t+1}_{-0.5}$$

$$= - \left( \Big[ -(t+1)^2 - (t+1) \Big] - \Big[ -(-0.5)^2 - (-0.5) \Big] \right) = (t+1)^2 + (t+1) + 0.25$$

This time it's a right way up parabola:

graph.jpg

Is that what you have also?
 
  • #9
roam said:
Oops, I did the integral again and there was a sign error as you suggested:

$$- \int^{t+1}_{-0.5} (-2t-1).dt = -\Bigg[ \frac{-2 t^2}{2} -t \Bigg]^{t+1}_{-0.5}$$

$$= - \left( \Big[ -(t+1)^2 - (t+1) \Big] - \Big[ -(-0.5)^2 - (-0.5) \Big] \right) = (t+1)^2 + (t+1) + 0.25$$

This time it's a right way up parabola:

graph.jpg

Is that what you have also?
Yes, I have the same result. ##(f*h)(t)=t²+3t+\frac{9}{4}## for ##t \in [-1.5, -1]##.
Notice that now the value in -1.5 is 0. The value of the first derivative in -1.5 is also 0. That is as expected, as ##f*h## is 0 below -1.5, and is a differentiable function.
 
  • Like
Likes roam
  • #10
Thank you so much for the explanation.

For case (c) I found:

$$(f*h)(t)= - \Big[ \int^0_{-0.5} f(t) h(\sigma) d \sigma + \int^{t+1}_{0} f(t) h(\sigma) d \sigma \Big] =- \Big[ \int^0_{-0.5} (-2t-1) d t + \int^{t+1}_{0} (2t-1) d t \Big]$$

$$= -(t+1)^2 + (t+1) + 0.25 = -t^2-t+\frac{1}{4}$$

This function is the inverted version of y=x2+3x+(9/4) we found for part (b).

For case (d) I found:

$$(f*h)(t)= - 2 \int^{0.5}_0 (2t-1)(f(t)=1) dt = 0.5$$

The graph in Matlab looks like this so far for ##t \leq 0## (parts (b), (c), and (d) are shown in magenta, blue and green respectively):

plot1.jpg


Since the ##(f ∗ h)(t)## is continuous and even I think the other half (in blue) should look like this:

graph1.jpg


Is this correct?
 
  • #11
Yes, I found the same results for cases c) and d).

As ##f*h## is even, you indeed can just take the mirror image of the graph for positive ##t##.
To be clear, from ##-1.5 \to -0.5## the graph segments are parabolic, not straight lines (and likewise on the positive side).
 
  • Like
Likes roam
  • #12
I get it now. Thank you so much for your time and help.
 

1. What is convolution calculation?

Convolution calculation is a mathematical operation that combines two functions to create a third function. It is commonly used in signal processing, image processing, and other areas of science and engineering.

2. How is convolution calculation performed?

Convolution calculation is performed by integrating the product of two functions, one of which is flipped and shifted, over a certain range. This process is repeated for every value of the independent variable to create the new function.

3. What is a piecewise function?

A piecewise function is a function that is defined by different equations over different intervals of the independent variable. It is commonly used to describe situations where the relationship between variables changes at certain points.

4. Why is piecewise function used in convolution calculation?

Piecewise functions are used in convolution calculation because they can accurately describe complex relationships between variables. They allow for different equations to be used for different parts of the calculation, which can lead to more accurate results.

5. What are some real-world applications of convolution calculation using piecewise functions?

Convolution calculation using piecewise functions has many real-world applications, including image and audio processing, signal filtering, and data analysis. It is also used in physics and engineering to describe the behavior of complex systems.

Similar threads

  • Calculus and Beyond Homework Help
Replies
2
Views
167
  • Calculus and Beyond Homework Help
Replies
1
Views
186
  • Calculus and Beyond Homework Help
Replies
1
Views
710
  • Calculus and Beyond Homework Help
Replies
3
Views
576
  • Calculus and Beyond Homework Help
Replies
1
Views
792
  • Calculus and Beyond Homework Help
Replies
12
Views
1K
  • Calculus and Beyond Homework Help
Replies
2
Views
2K
  • Calculus and Beyond Homework Help
Replies
4
Views
1K
  • Calculus and Beyond Homework Help
Replies
2
Views
1K
  • Calculus and Beyond Homework Help
Replies
23
Views
2K
Back
Top