compresslist.m

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

M
26
字号
function sqrList = compressList(sqrList);
%COMPRESSLIST Internal function to track nonlinear expressions

% Author Johan L鰂berg
% $Id: compressList.m,v 1.2 2004/07/02 08:17:29 johanl Exp $

bottom = 1;
while bottom<=size(sqrList,1)
    x1_list = find(ismember(sqrList(1:bottom,1),sqrList(bottom,2)));
    x2_list = find(ismember(sqrList(1:bottom,1),sqrList(bottom,3)));
    temp = [];
    if isempty(x1_list)
        temp = sqrList(bottom,2);
    else
        temp = sqrList(x1_list,2:end);
    end
    if isempty(x2_list)
        temp = [temp sqrList(bottom,3)];
    else
        temp = [temp sqrList(x2_list,2:end)];
    end
    sqrList(bottom,2:2+length(temp)-1)=temp;
    bottom = bottom+1;
end
sqrList = sqrList(:,1:max(find(any(sqrList,1))));
sqrList = [sqrList(:,1) fliplr(sort(sqrList(:,2:end),2))];

⌨️ 快捷键说明

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