function rP=LMIStabilityMargins(A)
%% set options for given solver
options=sdpsettings;
options.solver='sedumi';
options.showprogress=0;
options.verbose=0;
warning('off','YALMIP:strict');
%% size of matrix A
n=size(A,1);
%% clear yalmip state
yalmip('clear');
%% define variable matrices
P = sdpvar(n,n,'symmetric');
alpha_=sdpvar(1);
%% define inequalities LMI
LMIs = set([ ]);
%% use LMI variables
main_lmi = [P*A + A'*P + 2*alpha_*P];
LMIs = LMIs + set (alpha_ > 0, ['alpha_ > 0']);
LMIs = LMIs + set (P > 0, ['P > 0']);
LMIs = LMIs + set(main_lmi < 0, 'main_lmi < 0');
%% solve it
res=solvesdp(LMIs,-alpha_ , options);
%%
if res.problem == 0
fprintf('=================================================================================\n');
fprintf('Problem ...: %d\nInfo ......: %s\n', res.problem, res.info);
if all(checkset(LMIs)>=0)
fprintf('Everythings is all right :-)\n');
fprintf('=================================================================================\n');
else
%disp(LMIs);
%checkset(LMIs)
fprintf('### Some LMIs are not feasible :-( ###\n');
fprintf('=================================================================================\n');
end
rP = double(P);
else
res.problem
P=0;
end
Warning: Solver not applicable (sedumi)
ans =
-4