Take CT LQR
1. In LQR, we need to determine the performance measure first. The performance measure takes
the following form:
$J = \int_0^{\infty} [x^T Qx + u^T R u] dt$
(5)
We should pick $Q \ge 0$ and $R > 0$.
2. Solve the corresponding algebraic Riccati equation to get $P$. If $Q \ge 0$, $R > 0$ and $(A, B)$ is
controllable, $P$ should be positive definite. Check whether the obtained $P > 0$? Note that
you can pick $Q$ such that $Q = C^T C$ and $(A, C)$ is observable.
3. Find the optimal $u = -Kx$. Put the control law into the system
$\dot{x} = Ax - BKx = (A - BK)x$
(6)
4. Give the system an initial condition $x_0$ (or $x_0 = x_s - x_i$), and solve the system analytically
or numerically to get the state trajectories.
5. Once the above steps work, consider the nonlinear system directly. In this case, we have
$\dot{x} = f(x, u_s + u) = f(x, u_s - Kx) = f(x, u_s - K(x - x_s))$
Integrate the above nonlinear system using Euler's or RK4. Consider an initial condition that
is close to the steady state so that your LQR control law may work well.