1
$\begingroup$

Im basically messing around with discrete Fourier-Transformation and I cant figure out how to apply it. I know there exists a predefined command, but I want to learn the computation behind it and im trying to figure out the details.

I have a list of data:

data=Table[{i,Sin[2*Pi*i/100]+Sin[2*Pi*i/25] + RandomReal[{-1,1}] },{i,100}];

And I have a function F[k] of the variable k. Which is defined like this: F[k]=Sum[{i=1,100},Exp[-I*k*i]*x[i]] where x[i] is equal to data[[i,2]].

I need help to Plot the function F[k].

$\endgroup$
1
  • 1
    $\begingroup$ Read docs of Fourier, see details section for definition and properties and relations section, it contains the formula you are looking for $\endgroup$
    – I.M.
    Aug 7, 2023 at 11:52

1 Answer 1

3
$\begingroup$

You have a syntax error in Sum. The sum is written like:

data = Table[{i, 
    Sin[2*Pi*i/100] + Sin[2*Pi*i/25] + RandomReal[{-1, 1}]}, {i, 100}];
F[k_] := Sum[Exp[-I*k*i]*data[[i, 2]], {i, 1, 100}]

Now you can plot the real and imaginary part like:

Plot[Re@F[k], {k, 0, 2Pi}]
Plot[Im@F[k], {k, 0, 2Pi}]

enter image description here

$\endgroup$

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.