Assume that we have a nonlinear mass spring damper system.
$$m\ddot{x} + b\dot{x} |\dot{x}| + k_0 x + k_1 x^3 = u$$
And we find the lyapunov function of it. This function sums all the kinetic energy and potential energy.
$$ V(\dot x, x) = \frac{1}{2}\dot x^2+\frac{1}{2}k_0 x^2+\frac{1}{4}k_1x^4 $$
Remember that the state variables are time independent i.e $x(t) = x$
$$ \dot V(\dot x, x) = m \dot x\ddot x + k_0 x\dot x + k_1x^3\dot x $$
We find $\ddot x$ form the first equation(eliminating):
$$ \ddot x = \frac{u}{m} - \frac{b \dot x\vert\dot x\vert}{m} - \frac{k_0 x}{m} - \frac{k_1 x^3}{m} $$
And the lyapunov function will be:
$$ \dot V(\dot x, x) = m \dot x (\frac{u}{m} - \frac{b \dot x\vert\dot x\vert}{m} - \frac{k_0 x}{m} - \frac{k_1 x^3}{m}) +k_0 x\dot x + k_1x^3\dot x = \dot x u - b\dot x^2\vert\dot x\vert $$
Result:
$$\dot V(\dot x, x) = \dot x u - b\dot x^2\vert\dot x\vert$$
Now we assume a control law gains $L_1, L_2$ where $r$ is the reference vector.
$$u = -L_1\dot x - L_2 x + r$$
We will then get the function:
$$\dot V(\dot x, x) = \dot x (-L_1\dot x - L_2 x + r) - b\dot x^2\vert\dot x\vert = - L_1\dot x^2 - L_2 x \dot x+ \dot x r - b\dot x^2\vert\dot x\vert$$
This is the objective function, which I want to minimize.
$$J(L_1, L_2) = \int_{i}^N (- L_1\dot x^2 - L_2 x \dot x+ \dot x r - b\dot x^2\vert\dot x\vert)$$
Question:
How can find the gains $L_1, L_2$ by minimizing $J$? Do I first need to do a simulation for the open loop system, then collect $\dot x$ and $x$ states? What if the system is unstable i.e inverted pendulum. Then a open loop simulation won't help me to collecting $\dot x$ and $x$ states.