polytope.m
来自「matlab波形优化算法经常要用到的matlab toolbox工具箱:yalm」· M 代码 · 共 28 行
M
28 行
function p = polytope(X)
% polytope Converts set object to polytope object
%
% P = polytope(F)
% [P,x] = polytope(F)
%
% P : polytope object (Requires the Multi-parametric Toolbox)
% x : sdpvar object defining the variables in the polytope P.H*x<P.K
% F : set-object with linear inequalities
% Author Johan L鰂berg
% $Id: polytope.m,v 1.3 2005/02/04 10:10:27 johanl Exp $
if all(is(X,'element-wise'))% & all(is(X,'linear'))
f = [];
for i = 1:length(X)
if X.clauses{i}.type==2
fi = X.clauses{i}.data;
f = [f;fi(:)];
end
end
B = full(getbase(f));
p = polytope(-B(:,2:end),B(:,1));
else
error('polytope can only be applied to SET objects with linear inequalities.')
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?