The simple pendulum has the following equation of motion:
Jq̈ + mgl/2 sin θ = T,
where J is the pendulum's moment of inertia about the point of rotation and T is the applied torque.
(a) Let the state variables be x = [x1; x2] = [θ; θ̇] and the input to the system be u = T. Put the equation of motion into the nonlinear state space form, ẋ = f(x, u).
(b) Suppose that u = 0. Find the 2 equilibrium points xeq,1 and xeq,2 of the system.
(c) Linearize the nonlinear state space model about x̃ = [0; 0] and about the input ũ = 0 to obtain the linear state space model ẋδ = Axδ + Buδ, where xδ = x - x̃ and uδ = u - ũ. Do this by deriving the Jacobian matrices A and B.
(d) Suppose that there is no applied torque (T = 0) and the system starts at rest with the pendulum angle at θ = π/2. Use the MATLAB function ode45 to solve both the four 1st-order nonlinear equations of motion and the 1st-order linearized equations of motion from part (c). Use the parameters J = 1kgm^2, m = 1kg, and l = 1m. Plot θ over time from the nonlinear and linearized models in one figure, and plot θ̇ over time from both models in another figure. Hand in your code with your homework.