• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Fourier Animation Matthen  Feb 2nd, 2013 4,956 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. FourierF[a_, t_] := a.Table[Sin[2 Pi i t], {i, Length[a]}];
2. FourierAnim[a_, t_] :=
3.   Module[{A = Accumulate[a*Table[Cos[2 Pi i t], {i, Length[a]}]],
4.     B = Accumulate[a*Table[Sin[2 Pi i t], {i, Length[a]}]]}
5.    , PrependTo[A, 0]; PrependTo[B, 0];
6.    Show[Graphics[
7.      Table[{Circle[{A[[i]], B[[i]]}, a[[i]]], Darker[Red],
8.        If[i != Length@a,
9.         Line[{{A[[i]], B[[i]]}, {A[[i + 1]], B[[i + 1]]}}], {Red,
10.          Dashed, Line[{{A[[i]], B[[i]]}, {2, B[[i]]}}]}]}, {i,
11.        Length@a}], PlotRange -> {{-1.5, 3}, {-1, 1}}],
12.     Plot[FourierF[a[[;; -2]], t - \[Tau]], {\[Tau], 2, 3}]]];
13. a = Table[(1 - (-1)^i)/i, {i, 16}]/Pi;
14.
15. Manipulate[FourierAnim[a[[;; j]], t], {t, 0, 1}, {j, 1, Length@a, 1}]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top