Message Boards Message Boards

Append multiple plots with Manipulate

Posted 6 years ago

Let's say I have a function which has some parameters c and b associated with it,

Fx[b_, c_, y_, x_] := Sin[x/c] + Cos [b y]

For each value of c and b I want to be able to append all the graphs on top of each other using manipulate function. Right now I'm using Show function to plot all on top of each other, For {b= 2,4,6} and {c=1,5,10}

F1 = Plot[ Sin[x/2] + Cos [12 1], {x, -100, 100} , PlotStyle -> Green , PlotRange -> Automatic]
F2 = Plot[Sin[x/4] + Cos [12 5], {x, -100, 100} , PlotStyle -> Red , PlotRange -> Automatic]
F3 = Plot[Sin[x/6] + Cos [12 10], {x, -100, 100} , PlotStyle -> Blue , PlotRange -> Automatic]

and use show

Show[F1, F2, F3, PlotRange -> Automatic]

And I can also use

Manipulate[Show[F1, F2, F3, PlotRange -> {{x1, x2}, {y1, y2}}], {x1, -100,100}, {x2, -100, 100}, {y1, -1, 1}, {y2, -1, 1}]

And I see the plots , but it is time consuming if I have lets say 40 values for parameters b , c, gonna take forever. So I tried to use manipulate with Show instead of Plot, I redefined my functions as Such:

H1[x_, y_, b_, c_] := Plot[ Sin[x/b] + Cos [12 c], {x, -100, 100} , PlotStyle -> Green , PlotRange -> Automatic];
H2[x_, y_, b_, c_] := Plot[ Sin[x/b] + Cos [12 c], {x, -100, 100} , PlotStyle -> Blue ,  PlotRange -> Automatic];
H3[x_, y_, b_, c_] = Plot[ Sin[x/b] + Cos [12 c], {x, -100, 100} , PlotStyle -> Red , PlotRange -> Automatic]

and used this manipulate code:

Manipulate[Show[{H1, H2, H3}, PlotRange -> Automatic], {b, 1, 10}, {c, 1,10}]

But unfortunately, I cannot see plots.

Of course I can use manipulate to change the parameters

Manipulate[Plot[ Sin[x/c] + Cos [12 b], {x, -100, 100} , PlotStyle -> Red , PlotRange -> Automatic], {c, 1, 10}, {b, 1, 10}]

Which works fine, but then I could only copy the graph for each value but I can't append them on top of each other, So I thought maybe I can use manipulate with Show instead of plot.

I was wondering if there is a way to use manipulate function for each value of parameters such that the graph with one value saves and when select a new parameter value graph will automatically append on previous graph in other words every graph for given value freezes in single plot (with different plot style i.e. color and thickness)

Thank you,

Attachments:
POSTED BY: Arm Mo
Posted 6 years ago
POSTED BY: Matt Woodbury
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract