Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Problem in Convolution integral by fourier transformation !

  1. Dec 21, 2013 #1

    I am trying to numerically evaluate a convolution integral of two functions (f*g) using Fourier transform (FT) i.e using

    FT(f*g) = FT(f) multiplied by FT(g) (1)

    I am testing for a known case first. I have taken the gaussian functions (eq. 5, 6 and 7) as given in

    I am not using FFT but a naive implementation of FT. The problem I am facing is that the FTs are correct but convolution is not.

    When I do inverse FT I do get back the 3 gaussians as given in the wolfram link. However, eq. (1) is not satisfied.

    Is there any trick in eq. (1)? I would appreciate any suggestion.


  2. jcsd
  3. Dec 21, 2013 #2


    User Avatar
    Science Advisor

    You need to supply details of what is wrong. The concept is perfectly correct.
  4. Dec 22, 2013 #3
    I am giving the details below (equation numbers are from my original posts, except the equation I have written below).

    The sigma1 and sigma2 of eq. (5) and (6) are taken as 2.0 and 2.5

    I am using 128 points in my discrete FT (values -63 to +64). Inverse FT of the FT of these gaussians give back those functions (although there are some error - about 10 to 20% - e.g I am getting 0.102 when the actual value is 0.117).

    When I check FT(f*g) i.e. FT (gaussian of eq. (7)) = FT(f) multiplied by FT(g) (1)

    the following happens

    (1) the numerical values are same - however, FT(f*g) has alternate + and - signs for the numbers, while FT(f) mul FT(g) values are all positive

    (2) If I change the limits - from -20 to +20 (still 128 points), alternate signs remain but now the numerical values also differ between two sides of equ. (1) and (2).

    (3) I did the same with 512 points - results same as point (2) above.

    I guess, that even FT of gaussian functions requires some fine tuning of spacing and number of points to choose (i.e. why 10-20% error is coming). However, in eq. (1), sign alternation part if not clear to me.

    When I tried a function like exp(-kx)/x, my FT routine works fine (error less than 1%).

    I would appreciate any help.

  5. Dec 22, 2013 #4


    User Avatar
    Science Advisor
    Homework Helper

    It's a waste of time thinking about your other problems, until you have fixed that one.

    Try some simple functions where you know what the FFT should be. For example
    a constant function
    sine and cosine functions one period in the 128 points
    an alternating sequence of values +1, -1. +1, -1., ....,
    all the values zero except for one point.

    When those you can do an FFT and an inverse FFT of those and the answers are correct to 5 or 6 significant figures, not 10% or 20%, then you can try debugging your convolutions.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook