Bonus Problem (20pt) Consider the linearized modeling of an inverted pendulum
on a cart.
$(M + m)\ddot{x}(t) + b\dot{x}(t) = f(t) + ml\ddot{\theta}(t)$,
$(J + ml^2)\ddot{\theta}(t) - mgl\theta(t) = ml\ddot{x}(t)$.
(a) (10pt) Let the state variable be $z = \begin{bmatrix} x, \dot{x}, \theta, \dot{\theta} \end{bmatrix}^T$. Write the equation of
motion in state-space form and identify A and B matrices.
(b) (10pt) Let $M = 0.5$ kg, $m = 0.2$ kg, $b = 0.1$ N/(m\s), $l = 0.3$ m,
$J = 0.006$ kg m$^2$. Using MATLAB, plot impulse response using state space
model for 1 second.