Question 5.3.3: A Nonlinear Pendulum Model By studying the dynamics of a pen...

A Nonlinear Pendulum Model

By studying the dynamics of a pendulum like that shown in Figure 5.3.4, we can better understand the dynamics of machines such as a robot arm. The pendulum shown consists of a concentrated massm attached to a rod whose mass is small compared to m. The rod’s length is L. The equation of motion for this pendulum is
\ddot{θ} + \frac{g}{L} \sin θ = 0                     (1)
Suppose that L = 1 m and g = 9.81 m/s². Use MATLAB to solve this equation for θ(t) for two cases: θ(0) = 0.5 rad, and θ(0) = 0.8π rad. In both cases \dot{θ}(0) = 0. Discuss how to check the accuracy of the results.

5.3.4
The 'Blue Check Mark' means that either the MATLAB code/script/answer provided in the answer section has been tested by our team of experts; or the answer in general has be fact checked.

Learn more on how do we answer questions.

If we use the small angle approximation \sin \approx θ, the equation becomes
\ddot{θ} + \frac{g}{L} θ = 0            (2)
which is linear and has the solution:
θ(t) = θ(0) \cos \sqrt{\frac{g}{L} t}             (3)
Thus the amplitude of oscillation is θ(0) and the period is P = 2\pi \sqrt{L/g} = 2  s.We can use this information to select a final time, and to check our numerical results.
First rewrite the pendulum equation (1) as two first order equations. To do this, let x_{1} = θ and x_{2} = \dot{θ} . Thus
\dot{x}_{1} = \dot{θ} = x_{2}
\dot{x}_{2} = \ddot{θ} = − \frac{g}{L} \sin x_{1} = −9.81 \sin x_{1}

The following function file is based on the last two equations. Remember that the output xdot must be a column vector.

function xdot = pendulum(t,x)
xdot = [x(2); -9.81*sin(x(1))];

The function file is called as follows. The vectors ta and xa contain the results for the case where θ(0) = 0.5. The vectors tb and xb contain the results for θ(0) = 0.8π.

[ta, xa] = ode45(@pendulum, [0, 5], [0.5, 0]);
[tb, xb] = ode45(@pendulum, [0, 5], [0.8*pi, 0]);
plot(ta,xa(:,1),tb,xb(:,1)),xlabel('Time (s)'),...
ylabel('Angle (rad)'),gtext('Case 1'),gtext('Case 2')

The results are shown in Figure 5.3.5. The amplitude remains constant, as predicted by the small angle analysis, and the period for the case where θ(0) = 0.5 is a little larger than 2 s, the value predicted by the small angle analysis. So we can place some confidence in the numerical procedure. For the case where θ(0) = 0.8π, the period of the numerical solution is about 3.3 s.
This illustrates an important property of nonlinear differential equations. The free response of a linear equation has the same period for any initial conditions; however, the form of the free response of a nonlinear equation often depends on the particular values of the initial conditions.

5.3.5

Related Answered Questions