6
$\begingroup$
Manipulate[Column[{ Plot[Sin[a x], {x, 0, Pi}], Plot[Cos[a y], {y, 0, 2*Pi}], Plot[Tan[a z], {z, 0, 3*Pi}]}], {a, 1, 10}]

I want to put a popup menu here as Sin, Cos & Tan. So I can only display which plot want to display. Please help to do that.

Thanks in Advance.

$\endgroup$

3 Answers 3

8
$\begingroup$
Manipulate[Plot[f[[1]][a x], {x, 0, f[[2]] Pi}],
  {a, 1, 10}, 
  {{f, {Sin, 1}}, {{Sin, 1} -> Sin, {Cos, 2} -> Cos, {Tan, 3} -> Tan}, PopupMenu}]

enter image description here

$\endgroup$
4
$\begingroup$
Manipulate[
 Plot[f[a x], {x, 0, 2 Pi}
  ],
 {{f, Sin}, {Sin, Cos, Tan}},
 {a, 1, 10}
 , ControlType -> {PopupMenu, Slider}
 ]
$\endgroup$
4
$\begingroup$
Clear["Global`*"]

A slight variation on kglr's answer to track the original variable names.

Manipulate[
 Module[{
   func = {Sin, Cos, Tan}[[n]],
   var = {x, y, z}[[n]]},
  Plot[func[a*t], {t, 0, n*Pi},
   PlotRange -> If[n == 3, {-7, 7}, {-1, 1}],
   AxesLabel -> {var, func["a"*var]}]],
 {{a, 2}, 1, 10, 0.05, Appearance -> "Labeled"},
 {{n, 1, "function"}, Thread[Range[3] -> {Sin, Cos, Tan}], PopupMenu}]

enter image description here

$\endgroup$

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.