From ControlTheoryPro.com

1 Simple Pendulum Model using Lagrange Equations of Motion
A common problem in physics and controls is the simple pendulum. The system is easily described with a few parameter:
 M: Mass at end of pendulum
 l: Length of pendulum
 θ: Angular position of pendulum
Start with the Lagrange function (see Lagrange Equation of Motion for Conversative Forces & Lagrange Equations of Motion for NonConservative Forces for more information on Lagrange Equations of Motion) below
Lagrange Function 
Define Kinetic Energy
Kinetic Energy 
and Potential Energy
.  Potential Energy 
Substitute the Kinetic Energy and Potential Energy equations into the Lagrange function. The results is
.  ' 
Now that we've defined L we can move on to the Lagrange Equation below
.  Lagrange Equation 
To make things simple we will determine and . Let's begin with
.  ' 
Then
.  ' 
Put these back into the Lagrange Equation to get
.  ' 
And ultimately we end up with a final Simple Pendulum model via the Lagrange Equations of Motion of
' 
2 Notes
 Zak, Stanislaw H. Systems and Control. Oxford University Press, New York, 2003. ISBN 0195150112.