3
$\begingroup$

I wanted to know how can I generate a Lissajous plot for the forced driven pendulums (but for one pendulum in my case):

(https://demonstrations.wolfram.com/ForcedPendulumsWithDamping/).

I tried using this link https://demonstrations.wolfram.com/PathsOfTwoDimensionalOscillators/

to help me start but I keep getting errors.

Here is my attempt:

Manipulate[
  Module[{eqns, soln, \[Theta]1, t}, 
   eqns = {\[Theta]1''[t] + b \[Theta]1'[t] + Sin[\[Theta]1[t]] - 
       a Cos[\[Omega] t] == 0, \[Theta]1'[0] == 0, \[Theta]1[0] == 
      Pi/2};
   soln = 
    Flatten[NDSolve[eqns, {\[Theta]1, \[Theta]2}, {t, p - 1, p}, 
      Method -> "StiffnessSwitching"]];
   With[{ang1 = \[Theta]1[p] /. soln}, 
    Graphics[Point[{0, 0}], Line[{{0, 0}, L {Sin[ang1], -Cos[ang1]}}],
      Darker[Green, .2], Disk[L {Sin[ang1], -Cos[ang1]}, .5], Black, 
     PlotRange -> 12, ImageSize -> {300, 300}]]], 
  Show[{ParametricPlot[{Sin[\[Theta]1 t], a Cos[\[Omega] t]}, {t, 0, 
      end}, PlotRange -> 1, PlotRangePadding -> .1, 
     ImageSize -> {350, 350}, MaxRecursion -> 6], 
    Graphics[{RGBColor[.14, .67, .67], 
      Disk[{Sin[r end], Cos[1/r end]}, .025]}]}, 
   Axes -> False], {{r, 4/3, "ratio"}, .001, 
   10}, {{end, .001, "animate"}, .001, Infinity, 
   ControlType -> Trigger}, {{end, .001}, .001, 10, 
   ControlType -> None}, 
  AutorunSequencing -> {3}], {{b, .3, "damping coefficient"}, 0, 5, 
  Appearance -> "Labeled"}, {{L, 7.5, "length"}, .1, 10, 
  Appearance -> "Labeled"}, {{a, 0, "forcing amplitude"}, 0, 10, 
  Appearance -> "Labeled"}, {{\[Omega], 3.141, "forcing period"}, 0, 
  2. Pi, .001, Appearance -> "Labeled"}, {{p, 0, "animate"}, 0, 
  Infinity, ControlType -> Trigger}, {{p, 0}, 0, 10, 
  ControlType -> None}, AutorunSequencing -> {2, 6}]

Can anyone show me how I can have the Lissajous figures plotted underneath the driven forced pendulum. Also, how can I add a toggle that changes the driving frequency (just like how there is a toggle to chang the length in the first length and the ratio in the second link).

I would really appreciate the help!

Thank you!

$\endgroup$
3
  • $\begingroup$ I have a problem understanding your question. First, your code does not run. Then for Lissajou figures you need at least 2 dimensions. But if I interpret your code correctly, Theta1[t] is your variable and Omega[t] the driving force. Where is the second dimension? Or do you consider phase space and the second dimension is the momentum? $\endgroup$ – Daniel Huber May 6 at 15:16
  • $\begingroup$ I am trying to get my code running. I am not too sure how to do that. I wanted to create the Lissajou figures by plotting the angle of the pendulum (which is dependent on the parameter time) to be plotted in the y axis while the driving force to be plotted in the x axis. This way I can view at what frequency the resonance occurs. I am trying to look at the phase response by plotting the Lissajous figures at different frequencies $\endgroup$ – usernew May 6 at 15:27
  • $\begingroup$ My code was an attempt to have an animation of one damped pendulum under a driving force and another animation underneath showing the Lissajous figures that allows one to determine when the resonance frequency is reached (I know the resonance frequency is reached when the Lissajous figure looks like a circle rather than a tilted ellipse). I would also like to have a toggle for the driving frequency that shows how the lissajous figures changes from a tilted ellipse to a circle when the resonance frequency is reached $\endgroup$ – usernew May 6 at 15:36
4
$\begingroup$

The damped pendulum will always, after some initial time, obtain the frequency of the driver force, although with different phase shifts.

The following can serve as a start for further experimentation (Note, I reduced the number of parameters by choosing units to set the force constant to 1):

tmax = 500;
omegamax = .2;
dampmax = 0.1;
Manipulate[
 force[t_] = Cos[omega t];
 sol[t_] = 
  phi[t] /. 
   NDSolve[{phi''[t] + damping  phi'[t] + Sin[phi[t]] - force[t] == 0,
       phi[0] == Pi/2, phi'[0] == 0}, phi, {t, 0, tmax}][[1]];
 ParametricPlot[{force[t], sol[t]}, {t, 0, tmax}, AspectRatio -> 1]
 
 , {{damping, dampmax/2}, 0, dampmax}, {{omega, omegamax/2}, 0, 
  omegamax}, TrackedSymbols :> {damping, omega}]

enter image description here

$\endgroup$
5
  • $\begingroup$ This a great start! Thank you!. $\endgroup$ – usernew May 6 at 17:40
  • $\begingroup$ Do you just happen to know why the Lissajous figures never approaches a circle as I am changing the frequency? $\endgroup$ – usernew May 6 at 17:41
  • 1
    $\begingroup$ I think it takes some time for the inital conditions, the transient solution, to damp away and achieve the steady state. I think it should be faster with higher damping and omega. $\endgroup$ – Daniel Huber May 6 at 18:17
  • $\begingroup$ If I save this as a cdf file, it still can't be opened with wolfram player. Do you happen to know why $\endgroup$ – usernew May 7 at 0:41
  • $\begingroup$ I downloaded the player and tried the code, but I get a warning that my MMA may be too old and the CDF does not run in the player. I have version MMA 12.1 $\endgroup$ – Daniel Huber May 7 at 8:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.