Mathematica Asked on May 18, 2021
This is a sample snippet from Mathematica documentation for plotting Bessel for various n:
Plot[Evaluate[Table[BesselJ[n, x], {n, 4}]], {x, 0, 10},
Filling -> Axis]
How can you use Manipulate[] to animate this over both x and n (so if I wanted a slider for x and n). I’ve tried this:
Manipulate[
Plot[Evaluate[Table[BesselJ[n, x], {n, 4}]], {x, 0, xmax},
Filling -> Axis],
{xmax, 0, 10 , Appearance -> "Open"}
]
But get this error:
Replace 0
in {xmax, 0, 10 , Appearance -> "Open"}
with a small number (say, 10.^-5
) to avoid the error:
Manipulate[Plot[BesselJ[n, x], {x, 0, xmax}, Filling -> Axis,
PlotRange -> {{0, 10}, {-.7, .7}}],
{xmax, 10.^-5, 10, Appearance -> "Open"},
{n, 1, 4, 1}]
Use TogglerBar
as control to select subsets of Range[5]
to as the parameter n
:
Manipulate[Plot[Evaluate[BesselJ[#, x] & /@ n], {x, 0, xmax},
Filling -> Axis,
PlotRange -> {{0, 10}, {-.7, .7}}],
{{xmax, 6}, 10.^-5, 10, Appearance -> "Open"},
{{n, {1, 3}}, Range[5], TogglerBar}]
Correct answer by kglr on May 18, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP