This code will show a very tight correspondence between Fourier
and FourierTransform
. For the continuous case, note the imaginary negative infinite DiracDelta
spike at w=-1
(2nd term of answer), and the positive one at w=1
.
FourierTransform[2*Sin[x], x, w]
(*I*Sqrt[2*Pi]*DiracDelta[-1+w]-I*Sqrt[2*Pi]*DiracDelta[1+w]*)
Here is the original table range in your question modified slightly to fit an exact number of wavelengths. 32Pi
is slightly over 100, and Pi
/3 is a little more than 1. The pure function and Thread
are used to break the real and imaginary components into two separate lines for plotting purposes. This link shows the code snippet for dftMost
, which uses Fourier
.
ListPlot[Thread[{{#,Re@#2},{#,Im@#2}}&@@@
First[dftMost@Table[{x,2Sin[x]},{x,0,32Pi,Pi/3}]]],
Joined->True,PlotRange->All]
Note the negative and positive spikes in the imaginary component of the discrete Fourier transform at w=-1
and w=1
. If you use more points in the Table
command, the spikes will increase toward infinity.
DeleteCases[Chop@Cases[%,Line[pts_?MatrixQ]:>pts,
Infinity],{_,0},Infinity]
(*{{},{{-1.,-40.1061},{1.,40.1061}}}*)
Here we pull out the nonzero real and imaginary components from the blue (real) and orange imaginary components in the ListPlot graph above. There are no nonzero real compoents, so that first list is empty. The only two non-zero imaginary components are at w=-1
and w=1
in the 2nd list, as previously mentioned.
Bonus: You may also like to see a case where the continuous transform isn't integrated from negative to positive infinity, but is instead windowed. By changing the number of periods of integration, n
, you can watch the aforementioned frequency peaks gradually rise toward infinity.
fourierTransform[f_,{t_,tini_,tfin_},w_,a_,b_]:=
Sqrt[Abs@b/(2Pi)^(1-a)] Integrate[f Exp[I b w t],{t,tini,tfin}]
Assuming[{n>=1,(n/2)\[Element]Integers},With[{T=n 2Pi/w0},
fourierTransform[2 Sin[w0 t],{t,-T/2,T/2},w,0,1]/.w0->1//Simplify]]
(*2*I*Sqrt[2/Pi]*Sin[n*Pi*w]/(-1+w^2)*)
Plot@@{Through@{Re,Im}@%/.n->16,{w,-2,2},PlotRange->All}
Fourier
andFourierTransform
in the documentation? It is given in the first bullet point under Details and Options for both functions. $\endgroup$Fourier
andFourierTransform
$\endgroup$