Message Boards Message Boards

0
|
24104 Views
|
4 Replies
|
2 Total Likes
View groups...
Share
Share this post:

How to display the values of dynamic parameters in Manipulate?

Posted 12 years ago
Does anyone know how to display the values of dynamic parameters? In the code listed below it would be " numPts, freq, sampleRate and phi".

Manipulate[

td = Table[
N[Sin[(2 Pi freq t) + \]], {t, 0, numPts, 1/sampleRate}];

ListLinePlot


, {numPts, 100, 200}

, {freq, .1, 1}

, {sampleRate, 1, 20}

, {\, 0, 90}

, ContentSize -> {400, 300}



Thanks!
POSTED BY: steve burk
4 Replies
Perhaps like this?
 Manipulate[
  td = Table[N[Sin[(2 Pi freq t) + phi]], {t, 0, numPts, 1/sampleRate}];
  Column[{
    ListLinePlot[td, ImageSize -> Medium],
    Grid[{
      {"numPts", numPts},
      {"frequency", freq},
      {"Sample rate", sampleRate},
      {"phi", phi}}]}, Alignment -> Center], {numPts, 100,
  200}, {freq, .1, 1}, {sampleRate, 1, 20}, {phi, 0, 90},
ContentSize -> {400, 300}]
Which gives:
POSTED BY: Arnoud Buzing
I think your code got a bit messed up and you should correct it in accordance with moderation team's suggestions. Now with relation to your question. Arnoud's nice solution puts parameter values in the content area. There is also a default option Appearance -> "Labeled" to see the values in control area. Also you can just open control to see the value. 
Manipulate[
Plot[Sin[x (1 + a x)], {x, 0, 6}],
{{a, 1.34, "parameter"}, 0, 2, Appearance -> "Labeled"}]

POSTED BY: Vitaliy Kaurov
Welcome to Wolfram Community, Steve! Your post in its current formatting looks unreadable. On this site you should use usual formatting for text, but Mathematica code should be inclosed on designated code-boxes. First click Mathematica code button as shown on the image below, then paste the code from your notebook. Please edit your post and reformat it as we advised. To edit post click "Edit" link in the post's lower right corner.

Also please take a look at other posts on Community so you have an idea of proper formatting.

Thank you!

POSTED BY: EDITORIAL BOARD
I usually do this way:
 Manipulate[
  td = Table[N[Sin[(2 Pi freq t) + phi]], {t, 0, numPts, 1/sampleRate}];
  ListLinePlot[td, ImageSize -> Medium],
 
  {{numPts, 150,
    Dynamic@Panel[
      Row[{Style["Points number= ", Blue, 12],
        Style[numPts, Blue, 12]}], ImageSize -> {150, 40}]}, 100, 200},
  {{freq, 0.5,
   Dynamic@Panel[
     Row[{Style["Frequency= ", Blue, 12], Style[freq, Blue, 12]}],
     ImageSize -> {150, 40}]}, 0.1, 1},

{{sampleRate, 10,
   Dynamic@Panel[
     Row[{Style["Sample rate= ", Blue, 12],
       Style[sampleRate, Blue, 12]}], ImageSize -> {150, 40}]}, 1, 20},
{{phi, 10,
   Dynamic@Panel[
     Row[{Style["\[CurlyPhi]= ", Blue, 12], Style[phi, Blue, 12]}],
     ImageSize -> {150, 40}]}, 0, 90},


ContentSize -> {400, 300}]
Note the use of Panel for displaying the values of parameters. They help avoiding jerking. It should look as in the picture below. You may further play with the Panel sizes to make them looking nicer (smaller, larger) and occasionally to place them in two colums. But ask about that separately, if needed. Have fun.

POSTED BY: Alexei Boulbitch
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