coef.m

来自「GloptiPoly 3: moments, optimization and 」· M 代码 · 共 38 行

M
38
字号
function y = coef(x)
% @MPOL/COEF - Internal use only
% Returns the coefficient vector of polynomial X% D. Henrion, 30 November 2003
% Last modified by D. Henrion, 19 May 2006
  
global MMM

x = x(1); % scalar polynomials only

m = indmeas(x); % measure index

% scaling ?
scale = false;
if m > 0
 if isfield(MMM,'M')
  if length(MMM.M) >= m
   if isfield(MMM.M{m},'indvar') & isfield(MMM.M{m},'scale')
    if any(MMM.M{m}.scale ~= 1)
     scale = true;
    end
   end
  end
 end
end

if scale
 % with scaling
 S = MMM.M{m}.scale(MMM.M{m}.relmask(x.var))';
 y = x.coef.*prod(repmat(S,size(x.pow,1),1).^x.pow,2);
else
 % without scaling
 y = x.coef;
end

⌨️ 快捷键说明

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