0
$\begingroup$

This question already has an answer here:

I have a function (myfun):

scale = 3;
fun[x_] := E^(-(x^2/2))/\[Pi]^(1/4)
myfun[x_] := fun[x/scale]/Sqrt[scale]

that is normalized:

num = 50;
sampInt = 0.3;
mygrid = Table[sampInt*n, {n, -num/2 + 1, num/2}];
myfunvalues = N[myfun[mygrid]];
Total[myfunvalues^2]*(mygrid[[2]] - mygrid[[1]])

I know that the fourier transform of this function is also normalized:

ftmyfun[k_] = FourierTransform[myfun[x], x, k]
Integrate[ftmyfun[k]^2, {k, -Infinity, Infinity}]

However if I calculate the discrete fourier tranform

myftvalues = Fourier[myfunvalues];

and calculate it's normalization

myftgrid = 
  RotateRight[Range[-num/2 + 1, num/2]/(num*sampInt), num/2 + 1];
Total[Conjugate[myftvalues]*myftvalues]*(myftgrid[[2]] - 
   myftgrid[[1]])

I get a value of 0.22213 instead of 1. What am I doing wrong?

$\endgroup$

marked as duplicate by ftiaronsem, Jason B., LCarvalho, Jens, Community Jul 11 '17 at 18:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1
$\begingroup$

After spending some more time on this I found that this question is equivalent to

Numerical Fourier transform of a complicated function

and already has an answer there

$\endgroup$

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