I'm trying to built some random moving surface from a plane perturbed with random oscillators, and my current code isn't doing what I need yet, as seen from the Manipulate
box. I'm building the surface from an answer found here :
How to insert variable height in this random bumps function?
Here's the code:
Clear["Global`*"]
amplitude[x_, y_] := RandomReal[{0.5, 1.5}]
frequency[x_, y_] := RandomReal[{0.25, 0.75}]
phase[x_, y_] := RandomReal[{0, 2Pi}]
randomPoints[t_] := Table[{x, y, amplitude[x, y]Sin[frequency[x, y]t + phase[x, y]]}, {x, -30, 30, 5}, {y, -30, 30, 5}];
randomBumps[t_] := Interpolation[Flatten[randomPoints[t], 1], Method -> "Spline"];
Manipulate[
Plot3D[
Evaluate[randomBumps[t][x, y]],
{x, -10, 10},
{y, -10, 10},
PlotPoints -> 30,
PlotRange -> {{-10, 10}, {-10, 10}, {-3, 3}},
Axes -> True,
AxesOrigin -> {0, 0},
AxesStyle -> Directive[GrayLevel[0.5]],
ColorFunction -> "Rainbow",
MeshFunctions -> {(#3&)},
MeshStyle -> GrayLevel[0.25],
ImageSize -> 700
],
{
t, 0, 20, 0.01,
ImageSize -> Large,
Appearance -> {"Labeled", "Closed"},
AppearanceElements -> {"InputField", "Slider"}
},
ControlPlacement -> Bottom,
FrameMargins -> None,
FrameLabel -> {None, None,
Style["Some Funny Title", Bold, 14, FontFamily -> "Helvetica"]}
]
Preview, with some of the issue shown in red:
When I move the time slider, the surface shown above is wildly jumping in random ways, and it's not what I'm trying to do.
Consider the surface as a set of oscillators, a single one at each location of the $x \, y$ grid. The oscillators have a fixed random frequency $f$, random amplitude $A$ and random phase $\phi$. Once the code is run, the amplitudes, frequencies and phases are randomly selected and an interpolation surface is drawn from the resulting positions at time $t = 0$. For the next time step, these numbers shouldn't change. Each point of the surface should be smoothly oscillating vertically (with their fixed amplitudes, frequencies and phases). Currently, the Manipulate
box isn't showing this behavior: the numbers $A$, $f$ and $\phi$ appears to change randomly a each time step.
Or maybe it's the Spline Interpolation which creates a new surface at each time step?
How can I fix this issue?
Take note that I need the surface to be smooth and differentiable everywhere, for the three variables $x$, $y$ and $t$ (except at the edges).