📄 projection.m
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -