⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mpt_collect_equalities.m

📁 求解线性矩阵不等式简单方便--与LMI工具箱相比
💻 M
字号:
function Matrices = mpt_collect_equalities(Matrices,equalities)

% These were just found
Aeq_fixed = Matrices.G(equalities,:);
Beq_fixed = -Matrices.E(equalities,:);
beq_fixed = Matrices.W(equalities,:);

% For numerical reasons, remove fixed variables in old constraints
% (This will remove big numbers from big-M)
if ~isempty(Matrices.Aeq)
    fixed = find(Matrices.lb(1:Matrices.nu) == Matrices.ub(1:Matrices.nu));
    if ~isempty(fixed)
        Matrices.beq = Matrices.beq - Matrices.Aeq(:,fixed)*Matrices.lb(fixed);
        Matrices.Aeq(:,fixed) = 0;
    end

    skip = find(~any(full([Matrices.Aeq Matrices.beq Matrices.Beq]),2));
    if ~isempty(skip)
        Matrices.Aeq(skip,:) = [];
        Matrices.Beq(skip,:) = [];
        Matrices.beq(skip,:) = [];
    end
end

% These variables are fixed
fixed = find(Matrices.lb == Matrices.ub);
if ~isempty(fixed)
    fixed = fixed(find(fixed <= Matrices.nu));
end

Aeq = sparse(1:length(fixed),fixed,ones(length(fixed),1),length(fixed),size(Matrices.G,2));

Beq = zeros(length(fixed),size(Matrices.E,2));
beq = Matrices.lb(fixed);

% Merge everything with original equalities
Matrices.Aeq = [Aeq;Matrices.Aeq;Aeq_fixed];
Matrices.Beq = [Beq;Matrices.Beq;Beq_fixed];
Matrices.beq = [beq;Matrices.beq;beq_fixed];

⌨️ 快捷键说明

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