I am trying here to design an LQR controller using LMI method, the result obtained from cvx is very different from results obtained using matlab lqr built-in function! surely there are error affecting the results.
Any suggestions are appreciated. thanks in advance

check the attached code

When I try to solve the problem in cvx, I receive the following warning messages:

Warning: The use of strict inequalities in CVX is strongly discouraged,
because solvers treat them as non-strict inequalities. Please
consider using “>=” instead.

> In cvx.gt at 21
Warning: This linear matrix inequality appears to be unsymmetric. This is
very likely an error that will produce unexpected results. Please check
the LMI; and, if necessary, re-enter the model.
> In cvxprob.newcnstr at 241
In cvx.gt at 22
Warning: The use of strict inequalities in CVX is strongly discouraged,
because solvers treat them as non-strict inequalities. Please
consider using ">=" instead.

First of all: you need to declare P to be symmetric; and you may need to wrap your Ricatti equation in a sym() function to ensure it is numerically symmetric as well. Roundoff error can sometimes prevent an apparently symmetric construct from being exactly so.

And secondly you are going to have to figure out how to eliminate at least some of the strict inequalities; otherwise, the zero solution is valid. Read more here.

Thanks very much for your response. After I modified the code as shown below, The results has improved quite significantly, (almost matching the Matlab LQR built-in function results), thought I still receive the warning message:

Warning: This linear matrix inequality appears to be unsymmetric. This is
very likely an error that will produce unexpected results. Please check
the LMI; and, if necessary, re-enter the model.

You did not use sym as I instructed. I’m glad you’re getting close results. Still, the remaining differences are likely due to your use of 1e-10 to shift the inequalities. That number is “small” as far as the solvers are concerned.

Dear Sir I still don’t understand where to use “sym” !. Do you mean adding it to the constraint ? you mentioned in your previous answer that I have to “wrap your Ricatti equation in a sym()”, but I don’t use Riccati equation to design the LQR,I am posing the LQR problem as LMI optimization problem.

sym() takes the symmetric part of an expression. Use it anywhere you expect a symmetric matrix but, due to roundoff error, you might not have it. For instance: sym(A*P+P*transpose(A))