setpolynomials.m

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

M
25
字号
function setpolynomials
%SETPOLYNOMIALS Internal function

% Author Johan L鰂berg
% $Id: setpolynomials.m,v 1.3 2005/04/29 08:05:01 joloef Exp $

solution = sdpvar('getSolution');
lmi_variables = solution.variables;
opt_variables = solution.optvar;
sqrList = yalmip('sqrvariables');
polyvals = [];

if ~(isempty(lmi_variables) | isempty(sqrList))
    for i = 1:length(sqrList)
        indx1 = find(lmi_variables == sqrList(i,2));
        indx2 = find(lmi_variables == sqrList(i,3));
        if  ~isempty(indx1) & ~isempty(indx2)
            polyvals = [polyvals; sqrList(i,1) opt_variables(indx1)*opt_variables(indx2)];
        end    
    end
    if ~isempty(polyvals)
        assign(recover(polyvals(:,1)),polyvals(:,2));
    end
end

⌨️ 快捷键说明

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