detset.m

来自「国外专家做的求解LMI鲁棒控制的工具箱,可以相对高效的解决LMI问题」· M 代码 · 共 51 行

M
51
字号
function F = detset(t,P)
%DETSET Internal function used in construction of MAXDET formulations
%
% F = detset(t,P) creates the SET t < det(P)^(1/(2^ceil(log2(length(P)))))

% Author Johan L鰂berg 
% $Id: detset.m,v 1.3 2004/12/09 21:08:29 johanl Exp $  


[n,m]=size(P);

if max(n,m)==1
    F = set(P>0) + set(t<P);
end
if min(n,m)==1
    % Vector version (copy and pasted from below)
    p = 2^ceil(log2(max(n,m)));
    x = [P(:);ones(p-max(n,m),1)];
    F = set([]);
else
    % Is P square?
    if n~=m
        error('P has to be square in the constraint t<det(P)^1/n')
    end
    % Is P symmetric?
    if ~is(P,'hermitian')
        error('P has to be Hermitian in the constraint t<det(P)^1/n')
    end
    % Is P complex?
    if is(P,'complex')
        P = [real(P) imag(P);-imag(P) real(P)];
        [n,m]=size(P);
    end

    D = tril(sdpvar(n,n));
    delta = diag(D);
    F = set([P D;D' diag(delta)] > 0);
    p = 2^ceil(log2(n));
    x = [delta;ones(p-n,1)];
end

while p > 2
    x_new = sdpvar(p/2,1);
    for i = 1:p/2
        F = F + gmset(x_new(i),x(2*i-1),x(2*i));
    end
    x = x_new;
    p = p/2;
end
F = F+gmset(t,x(1),x(2));

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?