Homework 6 Solutions PS232

1. Consider the following unusual pendulum, where the rod suspending the bob is replaced by a .

The equations of motion for this system are

̈ ̇ ( )

̈ ̇ ̇

where is the length of the spring, is the equilibrium length of the spring, and is the angle the spring makes with the vertical. , , and are the spring constant, mass of the bob, and the due to gravity respectively.

Using ode45.m, find the motion of the bob as a function of time ( ( ) ( )) for at least two different

choices of initial conditions ( ( ) ( )). Make sure you choose a sufficiently large time duration to get a good picture of the overall motion. Convert the solutions to Cartesian coordinates and plot the orbits ( ( ) ( )) for each of the initial conditions you chose.

Hint: The equations of motion are two coupled second order differential equations. You will reduce them to four coupled first order differential equations. In other words, your “slopes function” needs to accept a four element vector y, and return a four element vector yslopes.

Problem 1 Solution

Several trajectories are shown below. The Matlab code used follows.

Main Script:

[t q]=ode45('springpendulum',[0 20],[0.31 0 .125*pi 0],odeset('RelTol',1e-5)); x=q(:,1).*sin(q(:,3)+pi); y=q(:,1).*cos(q(:,3)+pi); figure(1); plot(x,y); axis square xlabel('x-position of bob (m)','fontsize',14); ylabel('y-position of bob (m)','fontsize',14); title('Springy Pendulum','fontsize',14); set(gca,'fontsize',12);

Function Representing the Equations of Motion function y=springpendulum(t,x)

L=x(1); Ldot=x(2); theta=x(3); thetadot=x(4); b = 0.30; m = 0.05; k = 20; g=9.81; y=[ Ldot;... L*thetadot^2-k/m*(L-b)+g*cos(theta);... thetadot;... -2/L*Ldot*thetadot-g/L*sin(theta)];

2. The following implementation of the damped Duffing Equation describes the motion of a mass in a “double well” potential ̈ ̇

A plot of the potential for the undamped ( ) system and the corresponding force on the mass as a function of displacement is shown in the figure below.

a. First, take , , and ; in other words we will start with an undamped oscillator. Implement a numerical solution to the undamped oscillator using the doublewell.m function shown overleaf. First draw a trajectory for the following initial conditions and . Then do the same for and .

b. Now, add by setting and also add a sinusoidal forcing term: ( ) with . Solve the equation of motion for times seconds with initial conditions , and forcing amplitude . Plot the displacement as a function of time and the phase space trajectory. Describe the steady-state motion in words. Now redo this plot, but only plot the points in the phase space trajectory that correspond to steady-state motion. You can achieve this by limiting your plot to points corresponding to times after about 250 seconds by which time the transient will have mostly died out.

c. Without changing any of the other parameters, you will now try a number of different forcing amplitudes in the range . In the vicinity of , you should see a clear change in the steady state phase space trajectories from a single loop to a “double loop”. This is known as “period 2” motion due to the double loop.

d. Plot the displacement as a function of time for the period 1 motion ( ) and for the period 2 motion ( ). Make a note of the difference.

As you increase the drive amplitude , you will see period 4 motion corresponding to a quadruple loop in the phase space ( ), period 8 motion ( ) etc. This process is called period doubling. Soon, you will see chaotic motion appear when . It is said that we have reached chaos via the “period doubling route.” When the motion is chaotic, no regular pattern can be discerned in the phase space.

Then, as the forcing amplitude is increased further, to you suddenly find that the chaos disappears again and period 3 behavior emerges! This is known as a period 3 window. It appears in many chaotic systems. Period 3 behavior continues for a range of forcing amplitudes up to . At this point, we see the period 3 behavior double to become period 6. You can imagine what ensues. Chaos will soon re-appear as the forcing amplitude increases. Indeed, the forcing will push the oscillator across the boundary of the potential well when and chaos will reign on both sides of the well. Eventually, however if the forcing amplitude reaches a high enough value, chaos will again be suppressed and we will return to period 1 motion ( ). e. Produce eight plots of steady state phase-space trajectories for all the behaviors mentioned above: Period 1, Period2, Period 4, Period 8, Chaotic, Period 3, Period 6, Chaotic on both sides of the well, Return to Period 1 but traversing both sides of the well. Try to arrange the plots so that they only take up a single page. (You may want to use Matlab’s “subplot” function for this.)

Problem 2 Solution by former PS232 student E. Heaton. (The solution this student provided was as good as, or better than, the instructor’s version. The former student’s solution is provided here in lieu of the instructor’s version to motivate current students to perform at the same or higher level.)

For Part A of problem 2, I was to solve the duffing equation for the undamped, undriven case. This equation results in a double-well potential, with phase-space behavior (for an initial position resulting in a potential above the “potential barrier”) similar to a goggle shape. For an initial position resulting in a potential below the potential barrier, you get oscillations about one side of the well. And for an initial position resulting in a potential equal to the potential barrier, the particle oscillates about both sides with a pattern similar to the infinity-symbol. I first set the initial position x0=.816, then x0=.817. In the case of x0=0.816, the particle cannot clear the potential barrier and it oscillates about the right-half of the well. For x0=0.817 the particle barely clears the barrier and its phase-space trajectory resembles a bowtie as the is decreased to near-zero as it uses most of its energy to “climb up” the well. Figure 1 below the code for Problem 1A shows the results for these first 2 plots. Figure 2 and 3 show the time- traces of the two initial conditions for problem 2A. Figure 4 shows a number of different phase trajectories for different starting positions. x0 = .816; v0 = 0; z0 = [x0 v0]; [t z] = desolver('doublewell', [0 50], z0); x=z(:,1); v=z(:,2); plot(t,x) title('Time Trace of x0=0.816 undamped undriven') xlabel('Time [sec]') ylabel('Position [meters]') figure plot(x,v) title('Phase space of undamped, undriven duffing equation') xlabel('Position') ylabel('Velocity') hold on x0 = .817; v0 = 0; z0 = [x0 v0]; [t z] = desolver('doublewell', [0 50], z0); x=z(:,1); v=z(:,2); plot(x,v) hold off figure plot(t,x) title('Time Trace of x0=0.817 undamped undriven') xlabel('Time [sec]') ylabel('Position [meters]') figure

%Plot of phase trajectories with positive initial positions for x0=.1:.2:1.1 z0 = [x0 v0]; [t z] = desolver('doublewell', [0 15], z0); x=z(:,1); v=z(:,2); plot(x,v) title('Phase space of undamped, undriven duffing equation') xlabel('Position') ylabel('Velocity') hold on end

%Plot of phase trajectories with negative initial positions for x0=.1:-.2:-1.1 z0 = [x0 v0]; [t z] = desolver('doublewell', [0 15], z0); x=z(:,1); v=z(:,2); plot(x,v) hold on end

%Case where particle BARELY makes it over potential barrier x0 = .8165; z0 = [x0 v0]; [t z] = desolver('doublewell', [0 40], z0); x=z(:,1); v=z(:,2); plot(x,v) function zdot=doublewell(t,z) %undamped, undriven duffing equation alpha = 1; Beta = 3; gamma = 0;

%z = [position velocity] %z(1) = x %z(2) = v %zdot(1) = v = z(2) %zdot(2) = a %zdot = [velocity acceleration] zdot = [z(2); -2*gamma*z(2) - Beta*z(1)^3 + alpha*z(1)];

Figure 1: Phase-Space Plot for x0=0.816, x0=0.817 for Problem-2A

Figure 2: Time-Trace of Undamped Undriven Duffing Oscillator (x0=0.816)

Figure 3: Time-Trace of Undamped Undriven Duffing Oscillator (x0=0.817)

The next figure is also for Part A, and plots the phase-space for a number of different starting positions:

Figure 4: Phase-Space Plot for Problem-2A with Different Starting Positions

The figure above shows the phase trajectories of the undamped, undriven duffing oscillator for different initial positions within the potential well. Values between ~0.3 and ~0.8 cannot overcome the potential barrier in the middle and thus the particle oscillates on a single side of the well. When x0=0.8165, the particle can just barely overcome the middle potential, thus beginning the oscillations on both sides of the wells. Any initial position higher than 0.8165 results in the “goggle” shape mentioned earlier.

For Part B, I added damping and a forcing term. This is seen in the change from the function doublewell.m to the function drivenduffing.m. The code and resulting phase-space plot for the case of F0 = 0.18 and x0=0.5 are shown below. For time 0 to 500, we can see some transient behavior that dies off around 250 seconds, at which point the oscillations enter a steady-state which resembles the undamped, undriven oscillations about the right-half of the well. For Parts C and D I only dealt with time 250 to 750 seconds to throw out the transient effects (that severely complicated counting the period number). x0 = .5; v0 = 0; z0 = [x0 v0]; [t z] = desolver('drivenduffing', [0 500], z0); x=z(:,1); v=z(:,2); plot(t,x) title('Displacement of damped, driven duffing equation') xlabel('Time') ylabel('Position') figure plot(x,v) title('Phase space of damped, driven duffing equation (F0=.38)') xlabel('Position') ylabel('Velocity')

function zdot=drivenduffing(t,z) %undamped, undriven duffing equation alpha = 1; Beta = 3; gamma = .25; F0 = .18; wd = 1;

%z = [position velocity] %z(1) = x %z(2) = v %zdot(1) = v = z(2) %zdot(2) = a %zdot = [velocity acceleration] zdot = [z(2); -2*gamma*z(2) - Beta*z(1)^3 + alpha*z(1) + F0*sin(wd*t)];

Figure 5: Time Trace for F0=0.18, Shows Steady-State Behavior (Problem 2B)

Figure 6: Phase-Space of F0=0.18 (Problem 2B)

Figure 7: Phase-Space of F=0.18 (Problem 1B) for 250

In Part C, I zoomed in on the steady state behavior in the range of 450 to 500 seconds to see a closeup of the behavior of the displacement vs. time. I chose F0=0.195 for the period-1 behavior and F0=0.2 for the period-2 behavior (since the question said to choose F0=0.2 for both period 1 and period 2, I figured this was a typo).

Figure 8: Displacement vs. Time for Period-1 Behavior

Figure 9: Displacement vs. Time for Period-2 Behavior

The difference in the figures is obvious: for period-1 there is one period. The time between each consecutive peak is the time between the previous consecutive peaks. For period-2 oscillations, there are 2 separate periods, each corresponding to peak-to-every-other-peak.

For Part D, I used the previous code and changed the driving force as per the instructions on the homework to generate 9 phase plots: period-1, period-2, period-4, period-8, right-hand-side chaos, period-3, period-6, chaos across the entire well, and period-1 across the entire well. The driving forces used in the problem are in the title of each plot.

In some cases like period-4, period-8, and period-6, some of the double lines are close enough that they appear to just be one thick line. If we were to zoom in slightly it would be more apparent that they are distinct, separate loops in the phase-space.