Advertisement
Matthen

Fourier Animation

Feb 2nd, 2013
6,178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  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}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement