Convolution of Two Shifted Functions

1.5k Views Asked by At

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!