Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

[Mathematica] How to use this code?

  1. Jan 19, 2012 #1
    I have a notebook with the following code in it:

    Code (Text):
    GratingFrame[n_, c_, k_, \[Theta]_, \[Phi]_] :=
      Graphics[Raster[
        Table[0.5 +
          0.5 c Cos[
            2 Pi k (i  Cos[\[Theta] Pi/180]/n +
                j Sin[\[Theta] Pi/180]/n) - \[Phi] Pi/180], {j, 1, n}, {i,
           1, n}]]];

    GratingMovie[n_, T_, c_, k_, \[Theta]_] :=
     Module[
      {nf = 16},
      ListAnimate[
       Table[GratingFrame[n, c, k, \[Theta], \[Phi]], {\[Phi], 0,
         360 - 360/nf, 360/nf}], nf/T, ImageSize -> 200,
       AnimatorElements -> "PlayPauseButton"]
      ]
     
    The idea is to generate two moving images called gratings, using this code, with values n = 64, c = 0.5, k = 1, [itex]\theta = 0[/itex], [itex] \phi = 0[/itex], T = 0.75. Anyone know how I could do that?
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted