Message Boards Message Boards

Keep showing the function DiscretePlot using Manipulate?

GROUPS:

Hi,

I have an issue with "Manipulate" when used with the function "DiscretPlot". For instance, using the following command:

Manipulate[DiscretePlot[Sin[a*x + b], {x, 0, 40, 1}], {a, 0, 10}, {b, 0, 10}]

when i move the cursor of the "a" value, the segments under the dot values disappear and reappear when i stop moving (changing) the value. Is there a way to keep them showing even when I'm changing the value of 'a' or 'b'? I know they disappear to make it a smoother and faster movement but at some frequencies, we can't see the effect without seeing them moving.

Thank you for your help.

POSTED BY: Ghassane Aniba
Answer
5 months ago

Add in AutoAction -> True to show the line segments as the sliders are moved and a PlotRange to keep the graph from jumping around:

Manipulate[DiscretePlot[Sin[a*x + b], {x, 0, 40, 1}, PlotRange -> {{0, 41}, {-1, 1}}],
  {a, 0, 10}, {b, 0, 10}, AutoAction -> True]

Just hover the cursor over the slider to control it. (It takes a bit of getting used to it.)

POSTED BY: Jim Baldwin
Answer
5 months ago

Dear Jim,

Thank you for your message. This is exactly the effect i was looking for even if to control the cursor is not so easy to do, specially if i the Multiple function includes multiple parameters.

Thank you.

POSTED BY: Ghassane Aniba
Answer
5 months ago

I guess what you basically want is:

Manipulate[DiscretePlot[Sin[a*x + b], {x, 0, 40, 1}, PerformanceGoal -> "Quality"], {a, 0, 10}, {b, 0, 10}]

This of course can be combined with AutoAction -> True, then it appears to run even smoother.

POSTED BY: Henrik Schachner
Answer
5 months ago

Great, this is the effect i've been looking for. Thanks a lot.

POSTED BY: Ghassane Aniba
Answer
5 months ago

Henrik: Thanks! Using PerformanceGoal is even better. (Maybe in another 25 years I might actually feel I know something about Mathematica!)

POSTED BY: Jim Baldwin
Answer
5 months ago

Group Abstract Group Abstract