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

    function obj = pUpdateScaleFactor(obj)
%PUPDATESCALEFACTOR Update the scale factor stored in the linear constaint
%
%  CON = PUPDATESCALEFACTOR(CON)
%
%  The scale factor is used to ensure that the constraint distance for a
%  linear constraint has the correct growth. However, it can be expensive
%  to compute it a large number times and this is annoying when it is
%  constant.
%
%  See also CONLINEAR, CONLINEAR/CONSTRAINTDISTANCE.

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

cif = getActiveFactors( obj );
D = diag( 0.5 * (cif.Max - cif.Min) );

obj.ScaleFactor = sqrt( sum( (obj.A * D).^2, 2 ) );

%------------------------------------------------------------------------------|
% EOF
%------------------------------------------------------------------------------|