0
$\begingroup$

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[2] \[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.

$\endgroup$
1
  • $\begingroup$ PlotPoints -> 60 ? $\endgroup$
    – Akku14
    Oct 6, 2021 at 14:46

1 Answer 1

2
$\begingroup$

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]

enter image description here

Compare to what you had

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]

enter image description here

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]

enter image description here

$\endgroup$
2
  • $\begingroup$ Thanks a lot! This was very helpful. $\endgroup$
    – JayanthJ
    Oct 6, 2021 at 16:11
  • 1
    $\begingroup$ +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 $\endgroup$
    – Bob Hanlon
    Oct 6, 2021 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.