TransWikia.com

Plotting an Almost Fourier Transform like 3Blue1Brown

Mathematica Asked by vitamin d on April 6, 2021

Two years ago 3Blue1Brown posted this video. The important part starts at 9:38 to 9:54.

I am trying to plot his functions in Mathemtica. So, for the first plot with 2Hz I got

Plot[Sin[2*Pi*2*t] ,{t,0,2}]

which works perfectly fine. But I am not able to plot the "Almost Fourier = AF" Transform of that function. I think the definition of his AF is
$$mathfrak{F}_T{f(t)}(s)=intlimits_{-T}^{T}f(t)e^{-2pi its},mathrm{d}t,$$
where $T$ is an arbitrary real number. For $Ttoinfty$ we get the normal Fourier Transform, which is not practical to work with. I don’t know what value he picked for $T$ but let’s choose $T=10$. So, how can I program a plottable AF that looks exactly like the plot in his video?

One Answer

You could try

g[s_] = -Integrate[(Sin[2*Pi*2*t] + Sin[2*Pi*4*t])*Exp[-2*Pi*I*t*s], {t, -tt, tt}]; 
tt = 10; Plot[(1/(2*tt))*Im[g[s]], {s, 0, 5}, PlotRange -> All, 
AxesLabel -> {"freq.", "ampl."}]

for a spectrum of the sum of two sine functions with 2Hz and 4Hz respectively.

Edit: If you go with cosines instead of sines for the "input", then the spectrum will be real valued and you can take away the "-" in front of the integral.

Correct answer by Andreas on April 6, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP