www.gusucode.com > mbcdesign 工具箱 matlab 源码程序 > mbcdesign/@conellipsoid/upgrade.m
function con = upgrade(con, m) %UPGRADE Upgrade a constraint to have model information % % CON = UPGRADE(CON, M) % % For old forms of the constraint, this method will take all the % appropriate information from the model, M, and update the information in % the constraint, CON. This includes updating variable information and % inverse coding any data stored in coded units. The version number will % also be updated by this method. % % This method should be called from the LOADOBJ method of any object that % holds a constraint. Some objects may need to setup a post-load callback % if they do have an appropriate model at LOADOBJ time. % % See also CONBASE/UPGRADE, CONELLIPSOID/LOADOBJ. % Copyright 2005-2007 The MathWorks, Inc. and Ford Global Technologies, Inc. % The given constraint is % (y-xc)'*W*(y-xc) <= 1, % where y is coded units. For y in coded units the corresponding point x in % natural units is given by x = D*y + C where D is a diagonal matrix of % half-widths and C a vector of centers of the range of the factors. Thus % the constraint is % % (y-xc)'*W*(y-xc) <= 1, % (inv( D )*(x - C)-xc)'*W*(inv( D )*(x - C)-xc) <= 1, % (x - C-D*xc)'*inv( D )'*W*inv( D )*(x - C-D*xc) <= 1, % x-(D*xc+C))'*inv( D )'*W*inv( D )*(x-(D*xc+C)) <= 1, % % i.e., % new.xc = D * xc + C % new.W = inv( D )' * W * inv( D ) if con.version == 3.5, m = pMakeFriend( con, m ); % Upgrade parent con.conbase = upgrade( con.conbase, m ); % Need to map "xc" and "W" from coded units to natural units. con = pMapToNaturalUnits( con, m ); % Update version number con.version = 5.0; end %------------------------------------------------------------------------------| % EOF %------------------------------------------------------------------------------|