Message Boards Message Boards

0
|
4700 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Using Manipulate with ListLinePlot data

Posted 7 years ago

I am attempting to plot a frequency amplitude response for a simple Duffing Problem. I have a range defined for gamma. This means that a, the amplitude is known. The sigma is the frequency of the system. Sigma is a function of the amplitude and gamma. Since gamma is defined as a range the amplitude is known and thus we can find sigma. I plotted the amplitude vs the frequency. I now want to wrap the plot with manipulate so that i can vary the magnitude of the force F, damping parameter c, and the non linearity mue. This is the code i have so far. This plot generates with the slide bars. When i press play however the plot remains static. Please help. Thank You.

enter image description here

\[Omega] = 3.15;
\[Gamma] = Range[0.001, 3.1415, 0.001];
c = 0.01;
F = 0.1;
\[Mu] = 5;


a = (F*Sin[\[Gamma]])/(2*c*\[Omega]);
\[Sigma] = (3*\[Mu]*a^2)/(8*\[Omega]) - (F*Cos[\[Gamma]])/(
   2*a*\[Omega]);
data = Transpose@{\[Sigma], a};
Manipulate[
 ListLinePlot[data, PlotRange -> {{-1, 1}, {0, 1}}, 
  AxesLabel -> {sigma, amplitude}, 
  PlotLabel -> "MMS Duffing Frequency Response"], {{\[Mu], 1, 
   "Nonlinearity"}, 1, 5}, {{F, 0.1, "Force"}, 0.1, 
  1}, {{c, 0.01, "Damping"}, 0.01, 1}]
3 Replies
Posted 7 years ago

This one is a bit more efficient

\[Omega] = 3.15;
\[Gamma] = Range[0.001, 3.1415, 0.001];

Manipulate[
    (* Preliminaries *)
    a = (F*Sin[\[Gamma]])/(2*c*\[Omega]);
    \[Sigma] = (3*\[Mu]*a^2)/(8*\[Omega]) - (F*Cos[\[Gamma]])/(2*a*\[Omega]);
    data = Transpose@{\[Sigma], a};
    (* Output *)
    ListLinePlot[data,
     PlotRange -> {{-1, 1}, {0, 1}},
     AxesLabel -> {sigma, amplitude},
     PlotLabel -> "MMS Duffing frequency Response"
    ],
    (* Active controls *)
    {{\[Mu], 1, "Nonlienarity"}, 1, 5},
    {{F, 0.1, "Force"}, 0.1, 1},
    {{c, 0.01, "Damping"}, 0.01, 1},
    (* Local variables as controls *)
    {a, ControlType -> None},
    {\[Sigma], ControlType -> None},
    {data, ControlType -> None},
    (* Manipulate option *)
    TrackedSymbols :> {\[Mu], F, c}
 ]
POSTED BY: Hans Milton
Posted 7 years ago

The below is a MMA cell code copied into this post. Marking whats been pasted, then Ctrl+K (Windows). Copy back to a notebook of your own, and try it out.

Manipulate[
    (* Preliminaries *)
    a = (F*Sin[\[Gamma]])/(2*c*\[Omega]);
    \[Sigma] = (3*\[Mu]*a^2)/(8*\[Omega]) - (F*Cos[\[Gamma]])/(2*a*\[Omega]);
    data = Transpose@{\[Sigma], a};
    (* Output *)
    ListLinePlot[data,
     PlotRange -> {{-1, 1}, {0, 1}},
     AxesLabel -> {sigma, amplitude},
     PlotLabel -> "MMS Duffing frequency Response"
    ],
    (* Active controls *)
    {{\[Mu], 1, "Nonlienarity"}, 1, 5},
    {{F, 0.1, "Force"}, 0.1, 1},
    {{c, 0.01, "Damping"}, 0.01, 1},
    (* Local variables as controls *)
    {\[Omega], 3.15, ControlType -> None},
    {{\[Gamma], Range[0.001, 3.1415, 0.001]}, ControlType -> None},
    {a, ControlType -> None},
    {\[Sigma], ControlType -> None},
    {data, ControlType -> None}
 ]
POSTED BY: Hans Milton

Please make sure you know the guidelines: https://wolfr.am/READ-1ST

Do NOT post code as images.

Please EDIT your post, copy-paste and properly format your code as explained in the guidelines.

POSTED BY: Moderation Team
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