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)=\int\limits_{-T}^{T}f(t)e^{-2\pi its}\,\mathrm{d}t,$$ where $T$ is an arbitrary real number. For $T\to\infty$ 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?


1 Answer 1


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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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