A Nonlinear Pendulum Medel Matlab Help

A Nonlinear Pendulum Medel

By studying the dynamics of a pendulum like that shown in Figure 8.6-1, we can better understand the dynamics of machines such as a robot arm. The pendulum shown consists of a concentrated mass m 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
(j + ! sin 0 = 0 (8.6-3)
L
Suppose that L = 1m and g = 9.81 m/s2. Use MATLAB to solve this equation for OCt) for two cases: 0(0) = 0.5 rad and 0(0) = 0.8rr rad. In both cases 0(0) = O.Discuss how to check the accuracy of the results .
Solution
If we use the small angle approximation sin 0 ~ 0, the equation becomes .. g.
0+ -0 = 0 L
which is linear and has a solution given by (8.4-16):
(8.6-4)
OCt) = 0(0) cos J[t (8.6-5)
Thus the amplitude of oscillation is 0(0) and the period is P = 2rr/ Jg/ L = 2 s. We can use this information to select a final time and to check our numerical results. First rewrite the pendulum equation (8.6-3) as two first-order equations. To do
this,let

Capture

Thus
XI = iJ =X2
X2 = iJ = -!sin r,
L
The following function file is based on the last two equations. Remember that the output xdot must be a column vector.
function xdot = pend l(t,x)
global 9 L xdot = [x(2); – (g/L) *sin(x(1))];
It is called as follows. The vectors ta and xa contain the results for the case where 8(0) = 0.5. The vectors tb and xb contain the results for 0(0) = 0.8Jl’.
global 9 L
9 = 9.81;L = 1;
[ta, xa] = ode45(‘pendul’, [0,5]. [0.5,0]);
[tb,.xb] = ode45(‘pendul’, [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 8.6-2. The amplitude remains constant, as predicted by the small angle analysis. and the period for the case where 0(0) = 0.5 is a little longer

The pendulum angle as a ~ of time for two starting positions.

The pendulum angle as a ~ of time for two starting positions.

than 2 s, the value predicted by the small angle analysis. Therefore, we can place some confidence in the numerical procedure. For the case where 8(0) = O.Srr, the period of the numerical solution is about 3.3 s. This longer period 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 oftens depends on the particular values of the initial conditions

Posted on July 23, 2015 in Numerical Calculus And Differential Equations

Share the Story

Back to Top
Share This