Hi Johan,
when i use the same code (copied from the above link page) posted below:
A = [-1 2 0; -3 -4 1; 0 0 -2];
P = sdpvar(3,3);
F = [P >= 0, A'*P+P*A <= 0];
optimize(F); % for a feasible solution only
Pfeasible = value(P)
It reports errors:
error using: lmi/subsref (line 76)
Indexing type not supported
error in: optimize (line 14)
diagnostics =
solvesdp(OptimizationProblem.Constraints,OptimizationProblem.Objective,OptimizationProblem.Options);
error in: sdpex (line 17)
optimize(F);
The same errors happen when i add an objective function as
A = [-1 2 0; -3 -4 1; 0 0 -2];
P = sdpvar(3,3);
F = [P >= 0, A'*P+P*A <= 0];
obj = -P;
optimize(F,obj);
Pfeasible = value(P)
But it works as i try (replace 'optimize' by 'solvesdp')
A = [-1 2 0; -3 -4 1; 0 0 -2];
P = sdpvar(3,3);
F = [P >= 0, A'*P+P*A <= 0];
obj = -P;
solvesdp(F,obj);
Pfeasible = value(P)
or
A = [-1 2 0; -3 -4 1; 0 0 -2];
P = sdpvar(3,3);
F = optproblem([P >= 0, A'*P+P*A <= 0], -P);
optimize(F);
Pfeasible = value(P)
this two codes give the same result
Pfeasible =
1.0000 0.0723 -0.0091
0.0723 0.3667 0.0524
-0.0091 0.0524 0.5725
Should i always add an objective function even if i only need a feasible solution of LMIs?
Thanks for your attention!