RuikunZhou / Unknown_Neural_Lyapunov

Neural Lyapunov control of unknown nonlinear systems with stability guarantees
12 stars 0 forks source link

A question about V_lqr #1

Closed Yngjx closed 8 months ago

Yngjx commented 9 months ago

Hi, zhou

I want to ask you a question. In this Plotting.ipynb, you compared your own method with LQR, but you did not give the solution method for V_lqr in the code.For example:

def f(y,t):
    x1,x2 = y
    dydt = [-x2,
            x1+(x1**2-1)*x2]
    return dydt

ax = plt.gca()

V_lqr = 1.5*x1**2-x1*x2+x2**2

According to my understanding, to use lqr to solve P of the lyapunov function, you first need to linearize the state equation to find A and B, then set up two weight matrices Q and R, and finally use the lqr() function to solve.

I don't know if this is how you solved it. If so, can you give me a detailed solution process?

Thank you very much and wish you a happy life!

RuikunZhou commented 8 months ago

Hi,

You are right. You need to linearize the model first and then define Q and P matrices to have the LQR results. For this Van der Pol oscillator, we used the well-known results from Hassan K. Khalil's book. Please see Example 3.14 on page 64 for details.

Thanks.

Yngjx commented 8 months ago

Hi,

I see what you mean, this is very rewarding for me.

Thank you very much for your reply, best wishes!