2

I'm having some issues understanding the convolution of two rectangular functions. I have two rectangular pulses defined below and I need to find the convolution of them.

$$ f(x)= \prod ({x-1\over 3}) $$

$$ g(x)= \prod ({x-3\over 2}) $$

I've done it in matlab and wolfram-alpha and they give me the output below, which I'm assuming is correct.

enter image description here

EDIT: I've found an error in my matlab code where by limiting my x-axis, my convolution function moves around with respect to the functions it's convolving (because of how you must force conv() to produce a vector of the same length). I've placed what I think is the corrected version above.

My issue is that when I try to do this by hand, it seems to me that if I flip g(x) to g(-x), then begin shifting it right, then the convolution would have to start at -0.5 because that's where f(x) begins therefore that would be where the two functions begin interacting. My solution by hand looks like the one in matlab, however it starts at -0.5 and goes to 4.5 . What am I doing wrong? I know from my textbooks that f(x)*g(x) = g(x)*f(x) but to me it looks like if I choose to instead flip and shift f(x), my convolution would start at 2. If I do this in matlab however, I get the same output as is shown above.

How should I think about this? Given two functions, how does shifting them change their convolution? Thank you!

  • I'm getting yet a different answer: if the support of $f$ is $[-\frac12,\frac52]$ and the support of $g$ is $[2,4]$, then I would think the support of $f\ast g$ would be $[-\frac12,\frac52]+[2,4] = [\frac52,\frac{13}2]$. – Greg Martin Mar 17 '15 at 04:41
  • What you're saying also makes sense to me, but I'm not sure how to reconcile all of these results. – i_am_human_probably Mar 17 '15 at 04:50
  • Is your lower limit for the support of f * g supposed to be 3/2? Because that would be an interval of 5 which supports what mat-lab is showing and what I did by hand (besides the shifted interval). – i_am_human_probably Mar 17 '15 at 05:23
  • I figured out conceptually what I was doing wrong. I was referencing the shifted variable x always about the center of the function no matter if it was shifted or not. What I should have been doing was referencing the shifted value of x. For example in this problem, when you flip g(x) you have g(-x) between values -4 and -2. However, because x is shifted to the right by three (that is 3 places to the right from the middle of the pulse such that g(-x) actually has reference point at 0), when we start having interaction between the two functions, our reference point is already at 1.5. – i_am_human_probably Mar 17 '15 at 06:42

0 Answers0