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

    function con = conrange(cif)
%CONRANGE Range constraint for MBC
%
%  CON = CONRANGE(CIF)
%  CIF is a CONINPUTFACTOR object.
%
%  CONRANGE objects constrain points according to the equations 
%         A(I) <= X(I) <= B(I), I = 1, .., NF.
%
%  CONRANGE objects support being a local constraint in a two-stage constraint
%  and therefore allow the range of local factors to vary across the global space.
%
%  See also CONBASE, CONINPUTFACTOR.

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

if ~nargin
   cif = coninputfactor;
end

if isstruct( cif )
    % This form is used by the LOADOBJ method to cast a struct into an
    % object.
    parent = cif.conbase;
    con = mv_rmfield( cif, 'conbase' );

else
    parent = conbase( cif );
    
    mn = getMin( cif );
    mx = getMax( cif );
    
    con = struct( ...
        'Version', 3, ...
        'Center',    0.5 * (mx + mn), ...
        'HalfWidth', 0.5 * (mx - mn), ...
        'ScaleFactor', [] );
end

con = class( con, 'conrange', parent );

% Set the scale factor
con = pSetScaleFactor( con );