A Guide to MATLAB for Beginners and Experienced Users, Second Edition

Normally we think of a pendulum as a weight suspended by a flexible string or cable, so that it may swing back and forth. Another type of pendulum consists of a weight attached by a light (but inflexible) rod to an axle, so that it can swing through larger angles, even making a 360 rotation if given enough velocity.
Though it is not precisely correct in practice, we often assume that the magnitude of the frictional forces that eventually slow the pendulum to a halt is proportional to the velocity of the pendulum. Assume also that the length of the pendulum is 1 m, the weight at the end of the pendulum has mass 1 kg, and the coefficient of friction is 0.5. In that case, the equations of motion for the pendulum are as follows.
where t represents time in seconds, x represents the angle of the pendulum from the vertical in radians (so that x = 0 is the rest position), y represents the angular velocity of the pendulum in radians per second, and 9.81 is approximately the acceleration due to gravity in meters per second squared. Now here is a phase portrait of the solution with initial position x(0) = 0 and initial velocity y(0) = 5. This is a graph of x versus y as a function of t, on the time interval 0 < t < 20. (To use MATLAB s...