projection.m

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

M
56
字号
function F = projection(F,x,method)
% projection  Projects polytopic set object (Requires the Multi-parametric Toolbox).
%
% Fproj     = projection(F,x)
%
% F      : Polytopic set object
% x      : Variables to project on
% method : See HELP PROJECTION

% Author Johan L鰂berg
% $Id: projection.m,v 1.4 2005/02/04 10:10:27 johanl Exp $

if nargin<2
    error('Not enough input arguments.')
end

f = [];
for i = 1:length(F)
    if  F.clauses{i}.type==2
        fi =  F.clauses{i}.data;
        f = [f;fi(:)];
    else
        error('Only linear element-wise inequalities can be projected')
    end
end

if ~islinear(F)
    error('Only linear element-wise inequalities can be projected')
end

B = full(getbase(f));
P = polytope(-B(:,2:end),B(:,1));
y_vars = getvariables(F);

x_vars = getvariables(x);

if ~isempty(setdiff(x_vars,y_vars))
    error('Huh? Project on what! Some of those variables are not part of the original polyhedron');
end

x = recover(x_vars);

x_in_y = find(ismember(x_vars,y_vars));

if nargin == 2
    P = projection(P,x_in_y);
else
    Options.projection=method;
    P = projection(P,x_in_y,Options);
end

H = get(P,'H');
K = get(P,'K');

F = set(H*x < K);

⌨️ 快捷键说明

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