I have an exercise in which I am trying to filter an input signal $y(x) = \sin(x)$. Ideally, I would like to apply a box filter to this signal.

Previously, I successfully convolved the input signal $y(x)$ with a decaying response $h(x) = e^{-x}$.

I did so by the following the definition of convolution (e.g., integrating $\int_0^t\sin(x')e^{-(x-x')}\mathrm{d}x'$ and computing a damped sinusoidal signal.

My box filter is given by $\frac{1}{\Delta}$ for$|x-\xi| \leq \frac{\Delta}{2}$ and 0 elsewhere, where $\Delta$ is the filter width. I understand that a box filter is a local average, and I can implement this numerically, but I do not understand how to analytically integrate this as I did with the damped exponential 'filter'.

I tried to take the Fourier transform of $y(x)$ and $h(x)$ and multiplying them in Fourier space, but I could not figure out how to do so.

Thanks for any help.


1 Answer 1


DO NOT PASS GO; DO NOT Collect $200; DO NOT Take Fourier transforms, or worse yet, FFTs

You do the convolution exactly the way you would do any other convolution: start with the basic convolution integral (not what you wrote) and apply the properties of the signals that you are using to come up with an easier calculation. Begin with $$\int_{-\infty}^\infty y(x^\prime)h(x^\prime-x)\mathrm dx^\prime\tag{1}$$ and use the result that $h(\cdot)$ is nonzero only when its argument ($x^\prime-x$ in this instance) lies in the interval $\left[-\frac{\Delta}2, +\frac{\Delta}2\right]$. So, the integrand of the convolution integral is $0$ whenever $x^\prime$ is such that $$x^\prime-x > \frac{\Delta}2 \implies x^\prime > x + \frac{\Delta}2$$ or that $$x^\prime-x < -\frac{\Delta}2 \implies x^\prime < x - \frac{\Delta}2.$$ This allows us to simplify the convolution integral $(1)$ into $$\int_{x - \frac{\Delta}2}^{x + \frac{\Delta}2} y(x^\prime)\frac{1}{\Delta}\mathrm dx^\prime\tag{2}$$ where I have substituted the nonzero value of $h$ in the integral to save a step. Can you take it from here?

  • $\begingroup$ Thanks for the help. I think you have the integral bounds wrong. $\endgroup$
    – coffeecake
    Sep 24, 2019 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.