1
$\begingroup$

I am wondering if it is possible to manipulate/animate two (or three) parameters in a plot. I would imagine this would work, but doesn't:

waves[a_, b_, c_] := Sin[a b + c] Cos[a + b];
Animate[Plot3D[waves[a, b, c], {a, -2, 2}], {b, 0, 5}, {c, 0, 10}] 

I would like to manipulate/animate the parameters b and c. Is this possible? If so, what would the code look like?

$\endgroup$
  • $\begingroup$ Remove the '3D' from Plot3D as your equation is only a 2 dimensional equation. If you have 3 parameters you can either plot in 2D and animate 2 parameters, or plot in 3D and animate a single parameter. Plot3D is expecting to see 2 variables that it can vary along 2 different axes, but it only sees a in your code. $\endgroup$ – MassDefect Oct 8 at 17:08
1
$\begingroup$

As suggested by @MassDefect:

waves[a_, b_, c_] := Sin[a b + c] Cos[a + b];
Animate[
   Plot[waves[a, b, c], {a, -2, 2}, PlotRange -> {-1, 1}], 
   {b, 0, 5}, {c, 0, 10}]

enter image description here

$\endgroup$

Your Answer

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

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