loadsdpafile.m
来自「国外专家做的求解LMI鲁棒控制的工具箱,可以相对高效的解决LMI问题」· M 代码 · 共 60 行
M
60 行
function [F,h] = loadsdpafile(varargin)
%LOADSDPAFILE Loads a problem definition in the SDPA format
%
% [F,h] = loadsdpafile('filename') Loads the problem min(h(x)), F(x)>0 from file 'filename'
% [F,h] = loadsdpafile A "Open" - box will be opened
% Author Johan L鰂berg
% $Id: loadsdpafile.m,v 1.3 2005/06/17 13:02:01 joloef Exp $
filename = varargin{1};
% Does the file exist
if ~exist(filename)
filename = [filename '.dat-s'];
if ~exist(filename)
error(['No such file.']);
end
end
% Load using SeDuMi
try
[At,b,c,K,perm] = fromsdpa(filename);
catch
error('LOADSDPAFILE currently requires SeDuMi to be installed');
end
nvars = length(b);
x = sdpvar(nvars,1);
F = set([]);
top = 1;
if isfield(K,'l')
if K.l(1)>0
X = c(top:top+K.l-1)-At(top:top+K.l-1,:)*x;
F = F + set(X(:));
top = top + K.l;
end
end
if isfield(K,'s')
if K.s(1)>0
for i = 1:length(K.s)
[ix,iy,iv] = find([c(top:top+K.s(i)^2-1) At(top:top+K.s(i)^2-1,:)]);
off = (ix-1)/(K.s(i)+1);
if all(off == round(off))
X = c(top:top+K.s(i)^2-1)-At(top:top+K.s(i)^2-1,:)*x;
F = F + set(diag(reshape(X,K.s(i),K.s(i))) > 0);
top = top + K.s(i)^2;
else
X = c(top:top+K.s(i)^2-1)-At(top:top+K.s(i)^2-1,:)*x;
F = F + set(reshape(X,K.s(i),K.s(i)) > 0);
top = top + K.s(i)^2;
end
end
end
end
h = -b'*x;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?