User Tools

Site Tools


gibson:teaching:spring-2018:math445:lab11

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision Both sides next revision
gibson:teaching:spring-2018:math445:lab11 [2018/04/26 05:57]
gibson created
gibson:teaching:spring-2018:math445:lab11 [2018/04/26 08:59]
gibson
Line 1: Line 1:
-====== Math 445 lab 11: tick tock, the pendulum clock ======+====== Math 445 lab 11: home run ======
  
-==== Mathematical models ​of the plane pendulum ====+It is easy to determine the trajectory ​of a projectile subject to gravity if you neglect air resistance. It is much more difficult to solve if you include air resistance, especially if the 
 +flow becomes turbulent and the resistive force is nonlinear. We can solve the nonlinear case only numerically. ​
  
-In class we derived four different mathematical models of the plane pendulumlisted here in order of decreasing mathematical complexity+For this labyou will determine the minimum speed and optimal angle at which to hit a baseball 
 +in order to score a home run, both at sea level (Fenway) and at high altitude (Denver)Assume that 
  
-** Nonlinear damped pendulum.** This is the most physically realistic model. It includes a linear model of air resistance the $\alpha/m \; d\theta/dtterm and is accurate for large displacement angles ​$\theta$. +  ​the ball is hit 1 meter above home plate at speed $v_0$ and angle $\theta_0$. 
-\begin{eqnarray*+  the outfield fence is 120 meters (394 feet) from home plate and 3 meters high (about 10 feet).
-\frac{d^2\theta}{dt^2} + \frac{\alpha}{m} \frac{d\theta}{dt} + \frac{g}{\ell} \sin \theta = 0 +
-\end{eqnarray*}+
  
-** Nonlinear undamped pendulum.** This model neglects air resistance. It is derived from the previous model by setting ​the air resistance constant ​$\alphato zero. +**Problem 1:** Write a Matlab function that computes and plots the trajectory of the baseball and determines whether the ball clears the outfield fence. The function inputs should be $v_0$ and $\theta_0$, and the output should be the height of the ball when it reaches the fence.
-\begin{eqnarray*} +
-\frac{d^2\theta}{dt^2} + \frac{g}{\ell} \sin \theta = 0 +
-\end{eqnarray*}+
  
-** Linear damped pendulum.** This is valid only for small oscillations. You can derive it from the nonlinear damped pendulum model by substituting the //small angle approximation//​ $\sin \theta \approx \theta$ for small $\theta$.  +Use the following equations of motion, developed during class
-\begin{eqnarray*} +
-\frac{d^2\theta}{dt^2} + \frac{\alpha}{m} \frac{d\theta}{dt} + \frac{g}{\ell} \theta = 0 +
-\end{eqnarray*}+
  
-** Linear undamped pendulum.** The simplest pendulum model. It neglects air resistance and employs the small-angle approximation.  +$ dx/dt = v_x $
-\begin{eqnarray*} +
-\frac{d^2\theta}{dt^2} + \frac{g}{\ell} \theta ​+
-\end{eqnarray*}+
  
-In each of these, the variables are+$ dy/dt = v_y $ 
  
-  * $\theta(t)$: the unknown function that describes the angle of the pendulum away from vertical as a function of time. +dv_x/dt = -\frac{\mu}{m} v_x \sqrt{v_x^2 + v_y^2}
-  * $m$: the mass of the pendulum bob. +
-  * $\ell$: the length of the pendulum string +
-  * $g$: the acceleration of gravity +
-  * $\alpha$: an air resistance constant+
  
 +$ dv_y/dt = -\frac{\mu}{m} v_y \sqrt{v_x^2 + v_y^2} - g$
  
-In class we showed that the linear undamped pendulum has a solution of the form $\theta(t) ​\theta_0 \cos \omega twhere $\omega = \sqrt{g/\ell}$ and $\theta_0is an arbitrary initial angular displacement. (Note that $\theta_0must be small for the small-angle approximation to be valid!)+The constant ​$9.81 m/s^2is the acceleration due to gravity. The constant ​$\mu = \rho_{air} C_D A/2in the air resistance term depends on physical characteristics of the projectile ​and the air. The following code will calculate ​$\mufor a standard baseball, given either value of $\rho_{air}$.
  
-We also showed that the 2nd-order equation in the scalar variable $\theta(t)$ can be transformed into a 1st order equation in the vector variable $\vec{x}(t)$, using the substitution+<​code>​ 
 +rho_air ​ = 1.196; ​ % kg/m^3, density of dry air, 21 C, sea level   (Fenway) 
 +rho_air ​ = 0.986; ​ % kg/m^3, density of dry air, 21 C, 1 mile high (Denver)
  
-\begin{eqnarray*} +C_D 0.3;       % drag coefficient for baseball ​(rough sphere) 
-\vec{x} ​\left(\begin{array}{l} x_1\\ x_2 \end{array} \right) = \left(\begin{array}{l} \theta \\ d\theta/dt \end{array} \right+9.81;        % acceleration due to gravity in m/s^2 
-\end{eqnarray*}+r = 0.0375; ​     % radius of baseball in m (3.75 cm
 +A = pi*r^2;      % cross-sectional area of baseball in m^2 
 +m = 0.145; ​      % mass of baseball in kg (145 gm
  
-If you differentiate the above equation ​in time and perform a few substitutions between $\theta, d\theta/dt$ and $x_1, x_2$, you get +mu = rho_air*C_D*A/​2;​ % coefficient of nonlinear |v|^2 term, in mks units 
 +</code>
  
-\begin{eqnarray*} 
-\frac{d\vec{x}}{dt} = \left(\begin{array}{l} dx_1/dt\\ dx_2/dt \end{array} \right) = \left(\begin{array}{cc} 0 & 1 \\ -g/\ell & 0 \end{array} \right) \left(\begin{array}{c} x_1 \\ x_2 \end{array} \right) 
-\end{eqnarray*} 
  
-This equation is now of the form $d\vec{x}/dt = \vec{f}(\vec{x}) ​A\vec{x}$, so it can be solved numerically with Matlab'​s ''​ode45''​ function.+**Problem 2:** Determine ​the minimum initial ball speed and optimal angle that result in a home run, at sea level, and in Denver. You'll have to start with a guesses for $v_0$ and $\theta$ and tweak them by stages. For a starting point, recall that a good fastball clocks at 90 mph or roughly 40 m/s, and that 45 degrees is $\theta =\pi/4 \approx 0.78$. 
  
-----+Note that Matlab'​s ode45 function will return the x,y positions of the trajectory points at discrete time intervals, and it's unlikely that any of these will line up exactly with the outfield fence. However you can use interpolation to get the ball height y at exactly at the fence, as follows. If you set up your Matlab code so that $x$ is //x(:,1)// and $y$ is //x(:,2)//, the following code will determine the height $y$ of the ball at the position of the fence, $x=120$.  
 +<​code>​ 
 +yfence = interp1(x(:,​1),​ x(:,2), 120);   
 +</​code>​
  
-====Problem ​1: the linear undamped pendulum====+**Problem ​3:** Make a plot that shows the $x,y$ trajectory of the homerun hit with the minimal speed and optimal angle for sea level conditions, which you determined in problem 2. Now add another curve that shows what the path of that ball would be if there were no air resistance. Use a solid line for the curve with air resistance, and a dashed line for the curve without.
  
-Compare ​the analytic solution $\theta(t) = \theta_0 \cos \omega t$ of the linear undamped pendulum to a numerical solution computed with Matlab'​s ''​ode45''​ functionUse constants+**Problem 4:** Do the same as problem 3 for the home run in Denver
  
-  ​$g = 9.8$ (meters per second^2) +**Problem 5:** What are your answers for the minimal speed and optimal angle in the more familiar units of miles per hour and degrees, for both Boston and Denver?
-  ​$\ell = 1.0$ (meters) +
-  ​$\theta_0 = 0.1$ (radians) +
-  ​$m=1$ (kilogram)+
  
-Make three plots: ​ 
-  
-   - $\theta(t)$ versus $t$ (a //time series// plot)  
-   - $d\theta/​dt$ versus $t$ (a //time series// plot) 
-   - $d\theta/​dt$ versus $\theta$ (a //phase portrait//) 
  
-For the first two plots, show the analytic solution in solid lines and the numerical solution with solid lines with superimposed dots.  
  
-For the $d\theta/​dt$ versus $\theta$ plot, plot just the numerical solution. ​ Show a number of numerical solutions, using initial conditions $\vec{x}_0 = [\theta_0, 0]$ with $\theta_0$ varying from $0.01$ to $0.10$ in steps of $0.01$. Superimpose a quiver plot that shows the vector field $\vec{f}(\vec{x})$ which governs the time-evolution of the pendulum. ​ 
- 
-The plots should look something like this: 
- 
-{{:​gibson:​teaching:​spring-2016:​math445:​lab11:​problem1a.png?​400|}} {{:​gibson:​teaching:​spring-2016:​math445:​lab11:​problem1b.png?​400|}} 
- 
----- 
- 
-====Problem 2: the linear damped pendulum==== ​ 
- 
-If we include the damping of air resistance, the equations of motion of the linear damped pendulum are  
- 
-\begin{eqnarray*} 
-\frac{d}{dt} \left( \begin{array}{c} x_1 \\ x_2 \end{array} \right) = \left[ \begin{array}{cc} 0 & 1 \\ -g/l & -\alpha/m \end{array} \right] \left( \begin{array}{c} x_1 \\ x_2 \end{array} \right) 
-\end{eqnarray*} 
- 
-and the time series and phase portrait for (for $g=9.8$, $\ell=1$, $m=1$, and $\alpha=1$) look like 
- 
-{{:​gibson:​teaching:​spring-2016:​math445:​lab11:​problem2a.png?​direct&​400|}} {{:​gibson:​teaching:​spring-2016:​math445:​problem2b.png?​direct&​400|}} 
- 
-Now the temporal oscillations get smaller and smaller as time goes on. The phase portrait shows that all initial conditions eventually spiral into the origin, i.e. the pendulum hangs straight down ($\theta = 0$) and doesn'​t move $d\theta/dt = 0$). 
- 
-Write Matlab code to simulate the linear damped pendulum and reproduce the above plots. 
- 
----- 
-====Problem 3: nonlinear undamped pendulum==== 
- 
-If $\theta$ gets large the approximation $\sin \theta \approx \theta$ is no longer valid. This lab problem is an investigation of how the frequency of oscillation of the pendulum changes when the amplitude of the oscillation is large. Specifically,​ you'll determine if a more realistic nonlinear pendulum clock runs faster or slower than the idealized linear clock, and by how much, depending on amplitude. 
- 
-**(a)** Starting from the nonlinear undamped pendulum equation, revise the derivation from class to develop a nonlinear system of differential equations $d\vec{x}/​dt= \vec{f}(\vec{x})$ that is valid for large $\theta$. 
- 
-**(b)** Set up Matlab code to integrate this system of equations numerically,​ using Matlab'​s ''​ode45''​ function. 
- 
-**%%(c)%%** Determine the frequency of oscillation of the nonlinear pendulum for  
-for the constants $g=9.8$ and $\ell=1.0$ and a variety of oscillation amplitudes. 
-The oscillation amplitude is given by the angle $\theta_0$ at which the pendulum is released at time $t=0$, with no initial velocity. Determine the frequency $\omega$ for a variety of values in the range 
-$0 < \theta_0 < 2 \approx 115^{\circ}$ and plot $\omega$ versus $\theta_0$. ​ 
- 
-**(d)** For this range of amplitudes, the frequency $\omega$ of the nonlinear pendulum should vary with $\theta_0$ as 
- 
-<​latex>​ 
-\omega = \sqrt{g/l} + c \; \theta_0^2 
-</​latex>​ 
- 
-for some value of $c$.  Determine what the value of $c$ is from your graph in %%(c)%%. Do this by adding a curve of the above form to your plot from %%(c)%%, and adjusting the constant $c$ until this curve passes through the data points computed in %%(c)%%. What is the value of $c$? What does this mean for the accuracy of a pendulum clock? Would a real pendulum clock run fast or slow compared to the idealized linear clock if the amplitude of oscillation is too big?  
- 
----- 
- 
-====Problem 4: nonlinear damped pendulum==== ​ 
- 
-For this lab problem, you are to recreate the time series and phase portrait for the nonlinear damped pendulum, whose equations of motion are 
- 
-\begin{eqnarray*} 
-\frac{d}{dt} \left( \begin{array}{c} x_1 \\ x_2 \end{array} \right) = \left( \begin{array}{c} x_2 \\ -g/l \, \sin x_1 - \alpha/m \, x_2 \end{array} \right) 
-\end{eqnarray*} 
- 
-Use parameter values $g=9.8, \ell=1$, $m=1$, and $\alpha = 1$. For the time series plots, initiate the pendulum with $x_1 = \theta=0$ and $x_2 = d\theta/dt = 2$. For the phase portraits, show the range $-8 \leq \theta \leq 8$ on the horizontal axis and $-10 \leq d\theta/dt \leq 10$ on the vertical. On top of the quiver plots, show trajectories with initial conditions $\theta=0$ and a variety of $d\theta/​dt$ ranging from -10 to 10 in steps of 1.  
- 
----- 
-Turn in your code, your plots, and answer the following questions 
-====Questions (to be answered at the end of your lab)==== ​ 
- 
-**(a)** Describe the differences that you see in the phase portraits of the nonlinear pendulum compared to the linear pendulum. 
- 
-**(b)** For the undamped nonlinear pendulum, you should see trajectories with three distinctly different types of behavior. Give a physical interpretation of each of those three types of trajectories in terms of the motion of the pendulum. 
- 
-**%%(c)%%** You should also see three distinct type of trajectories for damped nonlinear pendulum. Give a physical interpretation of each of those types of trajectories. 
- 
-**(d)** The damped nonlinear pendulum has quite a few more distinct groups of trajectories than the ones shown in shown in your phase portrait. Based on your physical interpretation,​ what would those be? Revise your nonlinear damped phase portrait to show some of these other trajectories. ​ 
gibson/teaching/spring-2018/math445/lab11.txt · Last modified: 2018/05/01 06:23 by gibson