# Problem with 3D plot on using Animate

I'm trying to plot the function:

f[a_, b_, \[Alpha]_, \[Beta]_, s_, k_, \[Phi]_] := -((2 E^((2 k \[Beta]^2 (a^2 + b^2+ 2 \[Alpha]^2 - 2 Sqrt \[Alpha] (a Cos[\[Phi]] +b Sin[\[Phi]])))/(-2 \[Alpha]^2 + (-2 + k s) \[Beta]^2))k \[Beta]^2)/(-2 \[Pi] \[Alpha]^2 + \[Pi] (-2 + k s) \[Beta]^2))


I would like to create an animation of this function as I vary the parameter 'k' from 0 to 1 as follows.

Animate[Plot3D[f[a, b, 2, 200, 1, k, \[Pi]/2], {a, -10, 10}, {b, -10, 10},PlotRange -> All, LabelStyle -> Directive[Bold, Medium], Mesh -> None, ColorFunction -> (ColorData["TemperatureMap", #2/10] &), ColorFunctionScaling -> False], {k, 0, 1}, AnimationRunning -> False]


However, the animation of the 3D plot doesn't show the top most part of the generated surface. Any help on this would be really appreciated.

• PlotPoints -> 60  ? Oct 6, 2021 at 14:46

the animation of the 3D plot doesn't show the top most part of the generated surface

Add PerformanceGoal -> "Quality" It was not showing it all before, because default is Speed

Animate[
Plot3D[f[a, b, 2, 200, 1, k, \[Pi]/2], {a, -10, 10}, {b, -10, 10},
PlotRange -> All, LabelStyle -> Directive[Bold, Medium],
Mesh -> None,
ColorFunction -> (ColorData["TemperatureMap", #2/10] &),
ColorFunctionScaling -> False, PerformanceGoal -> "Quality"],
{k, 0, 1},
AnimationRunning -> False] Animate[
Plot3D[f[a, b, 2, 200, 1, k, \[Pi]/2], {a, -10, 10}, {b, -10, 10},
PlotRange -> All, LabelStyle -> Directive[Bold, Medium],
Mesh -> None,
ColorFunction -> (ColorData["TemperatureMap", #2/10] &),
ColorFunctionScaling -> False],
{k, 0, 1},
AnimationRunning -> False] Btw, I think a better animation would be to fix the vertical range. This way you can see better what is going on, and see the context better.

You'd have to run this couple of times first to see what is the maximum range needed, then hardcode this range in. Like this

Animate[
Plot3D[f[a, b, 2, 200, 1, k, \[Pi]/2], {a, -10, 10}, {b, -10, 10},
PlotRange -> {Automatic, Automatic, {0, 0.6}},
LabelStyle -> Directive[Bold, Medium], Mesh -> None,
ColorFunction -> (ColorData["TemperatureMap", #2/10] &),
ColorFunctionScaling -> False, PerformanceGoal -> "Quality"],
{k, 0, 1},
AnimationRunning -> False] • Thanks a lot! This was very helpful. Oct 6, 2021 at 16:11
• +1 The maximum value is MaxValue[{f[a, b, 2, 200, 1, k, Pi/2], -10 < a < 10,-10 < b < 10, 0 <= k <= 1}, {a, b, k}] which evaluates to 10000/(5001*Pi) or 0.636492 Oct 6, 2021 at 16:17