0
$\begingroup$

As the title says I am trying to add a 3D-Graphic (e.g. a cuboid) to an animation. But maybe I first shold tell you a little bit about my topic;

My goal is to make an animation for the Young's double-slit-experiment. So I alyready created an animation for the incoming wave. With the 3D cuboid I want to represent the slit.

But now I am struggling when I´m putting these two things together. I post you a simplified version of my code, because if I use the real data here, it would take loads of time for the calculation (especially for the animation).

First the 3D-blocks:

p4 = RegionPlot3D[0 <= x <= 6 && 0 <= y <= 25 && 0 <= z <= 0.1 , 
       {x, 0, 100}, {y, 0,60}, {z, 0, 0.1}, Mesh->False, PlotPoints -> 100, 
       PlotStyle -> Opacity[.3], Boxed -> False, Axes -> {True, True, True}];

p5 = RegionPlot3D[16 <= x <= 22 && 0 <= y <= 25 && 0 <= z <= 0.1 , 
       {x, 0, 100}, {y,0, 60}, {z, 0, 0.1}, Mesh -> False,PlotPoints -> 100, 
       PlotStyle -> Opacity[.3], Boxed -> False, Axes -> {True, True, True}];

Graphics3D[{p4[[1]],p5[[1]]},Lighting -> "Neutral", BoxRatios -> {3,2,5}, Boxed -> False]

And now an arbitrary wave-package:

u = 2; (*velocity in x-direction*)
iMax = 5;

Wavefunction[x_, y_, t_] := Sum[i*PDF[NormalDistribution[0, 1], x - u*t]*
   PDF[NormalDistribution[0, 1], y], {i, 1, iMax}]

dataWF = Table[Flatten[Table[{x, y, Wavefunction[x, y, t]},{x, 0, 10, 0.25},{y, -10, 10}], 1], {t, 0, 5, 0.1}];

animationWF = ListAnimate[ListPlot3D[# , PlotRange -> {0, 3}, Boxed ->False, 
     Axes -> {True, True, False}, Mesh -> None, ColorFunction-> "DarkRainbow"] & /@ dataWF]

But now I have no clue how to add these two to one animation (with static blocks). I tried several things, but due to I am quite new with Mathematica I'm running out of ideas what I can do else.

I hope some of you can help me?

Thanks a lot!

$\endgroup$
  • $\begingroup$ "I tried several things, but..." - which things? Show can combine Graphics3D and ListPlot3D. $\endgroup$ – Vitaliy Kaurov Oct 8 '17 at 12:48
  • $\begingroup$ Hi! Thank's for your quick respond! I've already tried Show. It works fine with ListPlot3D and Graphics3D, but it doesn't work with ListAnimate. I thought that it would maybe be better to combine my wavefunction and the blocks first with Show and then animate it, but poorly then the animation didn't work. So how would I manage it best to use the data from dataWF to create a plot (for each time t), which I combine by using Show with my blocks and THEN animate it? $\endgroup$ – pcalc Oct 8 '17 at 17:47
  • $\begingroup$ @VitaliyKaurov; I kept on trying and I think now it works with Show. Thank you very much for this hint! $\endgroup$ – pcalc Oct 9 '17 at 7:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.