Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (* Author: Ruslan Kabatsayev. I place this code in public domain. *)
- wave[x_] = Piecewise[{{Cos[x], x < 0},
- {Cos[x/Sqrt[2]]^2, x < Pi/Sqrt[2]}},
- 0]
- show[t_, reflectedAmplitude_] := With[{circleRadius = 0.2}, Show[
- Graphics[{
- {If[reflectedAmplitude != 1, Lighter[Gray], Transparent],
- Rectangle[{0, -(1 + reflectedAmplitude) - 2*circleRadius},
- {4*circleRadius, (1 + reflectedAmplitude) + 2*circleRadius}]},
- {Thick, Darker[Gray], Line[{{0, -(1 + reflectedAmplitude) - 2*circleRadius},
- {0, (1 + reflectedAmplitude) + 2*circleRadius}}]},
- Circle[{0, (1 + reflectedAmplitude)*wave[-t]}, circleRadius]
- }],
- Plot[{wave[x - t] + reflectedAmplitude*wave[-t - x]}, {x, -25, -circleRadius},
- PlotRange -> All, Exclusions -> None, PlotStyle -> Directive[Thick, Brown]],
- PlotRange -> All, ImageSize -> 700, AspectRatio -> Automatic, Axes -> False]
- ]
- Monitor[tab=Table[show[t,1],{t,-27,50,0.2}];,t]
- Monitor[Do[
- Export["/tmp/full-refl-frame-" <> ToString[1000 + n] <> ".bmp",
- tab[[n]]], {n, Length@tab}], {n, Length@tab}]
- Monitor[tabPartialReflection = Table[show[t, 0.3], {t, -27, 50, 0.2}];, t]
- Monitor[Do[
- Export["/tmp/partial-refl-frame-" <> ToString[1000 + n] <> ".bmp",
- tabPartialReflection[[n]]], {n, Length@tabPartialReflection}], {n,
- Length@tabPartialReflection}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement