www.gusucode.com > mbcdesign 工具箱 matlab 源码程序 > mbcdesign/@conrange/setRange.m
function con = setRange(con, A, B) %SETRANGE Set the min and max values of the range for each factor % % CON = SETRANGE(CON, A, B) % % A and B must be row vectors with nfactors( CON ) elements with the min and max % value for each factor. For inactive factors, use A(i) = -inf and B(i) = inf. % % See also CONRANGE, CONRANGE/GETRANGE. % Copyright 2000-2005 The MathWorks, Inc. NF = nFactors( con ); A = A(:)'; B = B(:)'; if size( A, 2 ) ~= NF || size( B, 2 ) ~= NF, error(message('mbc:conrange:InvalidArgument')); end % If either A or B has an inf then that factor is not active ai = ~( isinf( A ) | isinf( B ) ); if ~any( ai ), error(message('mbc:conrange:InvalidArgument1')); end % So, we only care about the active factors A = A(ai); B = B(ai); % Set all the values in the constraint con.conbase = setActiveIndices( con.conbase, find( ai ) ); con.Center = 0.5 * (B + A); con.HalfWidth = 0.5 * (B - A); %------------------------------------------------------------------------------| % EOF %------------------------------------------------------------------------------|