Step 1: Define the States and Control Inputs

Step 2: Develop Equations of Motion

Step 3: Linearize the System

Step 4: Formulate the State Space Model

Step 5: Define the Cost Function for LQR

Step 6: Compute the LQR Gain Matrix