www.gusucode.com > mbcdesign 工具箱 matlab 源码程序 > mbcdesign/@conellipsoid/setFeatures.m

    function [con, ok] = setFeatures(con, beta)
%SETFEATURES Set the features (parameters) for a local constraint
%
%   [CON, OK] = SETFEATURES(CON, BETA) sets the features (parameters) of the
%   local constraint CON to BETA.
%
%   See also CONELLIPSOID, 
%            CONELLIPSOID/GETFEATURES,
%            CONELLIPSOID/SETFEATURES,
%            CONELLIPSOID/NFEATURES.

%  Copyright 2000-2005 The MathWorks, Inc. and Ford Global Technologies, Inc.

ok = true;
nf = nActiveFactors( con );
beta = beta(:).'; % make beta a row vector

% extract matrix from beta
W = zeros( nf );

i = find( triu( ones( nf ) ) );
W(i) = beta((nf+1):end);

W = W'*W;

% set model parameters
con.xc = beta(1:nf);
con.W = W;
con.scalefactor = 1;