I have been playing around with convolutions in scipy's signal package:

N = 2**16
t = np.linspace(-4, 4, N)
h = rect(t, -1, 1)

scipy_conv = signal.fftconvolve(h, h, mode = 'same')
scipy_conv = scipy_conv/max(scipy_conv)

ax1.plot(t, h, label = r'$h(t)$')
ax1.plot(t, scipy_conv, label = r'$(h*g)(t)$ (SciPy)', linestyle = '--')

which as expected produces the plot enter image description here

However, if I omit the artificial normalising done by diving by the maximum value of the convolution, the convoluted signal has a massive value: enter image description here

My question is, how should I go about correctly normalising the convolution so that its amplitude would match that of the analytic result of the convolution of the rectangle with itself?

I'm aware this is somehow artefact of the fact we are using DFTs and not continuous FFTs, and that the answer is likely very simple, I am just rather confused. Any help or pointers to an answer I have missed is much appreciated. Thanks in advance.

  • 1
    $\begingroup$ Welcome to scicomp! I remember that when using the FFTW library you have to normalize by the array length. I am not sure about scipy though, but maybe you can check that in the documentation. Also there are different definitions of the fourier transformation. In some books you find a symmetric scale factor for the forward and the backward transformation, and in others the full scale is applied only in one direction. hth $\endgroup$
    – MPIchael
    Oct 31 '19 at 9:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.