1
$\begingroup$

I'm trying to write some code (eventually in Fortran) to quickly calculate the Voigt profile using the convolution theorem. However, I ran into some trouble using the Intel MKL FFT library, so I'm trying to mock up the code in Mathematica. As a first step, I'm trying to DFT a sampled Gaussian -- this should give me another Gaussian. However, when I look at the area under the curve, I no longer get unity, and the integral depends on the number of points. What's the proper normalization? I tried following this answer but didn't get very far.

num = 2^16
range = 1000;
dt = range / num // N
dw = 2 Pi / (num dt) // N

time = Table[(j-(num/2))*dt, {j, 1, num}];
freq = Table[(j-(num/2))*dw, {j, 1, num}];

sig = 1;

gaus[x_] := 1/(Sqrt[2 Pi sig^2]) Exp[-x^2/(2 sig^2)]

gtdata = gaus[time];
nydata = RotateLeft[gtdata, num/2-1]; (* shift centroid to index 1 *)
gwdata = RotateRight[Fourier[nydata], num/2-1]; (* transform and shift to center*)

Total[gtdata*dt]
Total[gwdata*dw]

This gives me 1. and 0.641697-3.08149*^-33 I -- shouldn't they both be 1.?

$\endgroup$
  • 3
    $\begingroup$ The DFT can be normalized using the ` FourierParameters->{a,b}` as specified in the Details section of the docs. Different choices of a and b use different normalizations. $\endgroup$ – bill s Oct 5 '15 at 21:29
  • $\begingroup$ This question is equivalent to mathematica.stackexchange.com/questions/1714/… and already has an answer there $\endgroup$ – ftiaronsem Jul 11 '17 at 14:09

Browse other questions tagged or ask your own question.