www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgoptim/setFreeValueRange.m
function optim = setFreeValueRange(optim, pValue, Range) %SETFREEVALUERANGE Set the operating range of free variables % % SETFREEVALUERANGE(OPTIM, PVALUE, RANGE) sets the free value PVALUE to % have the range RANGE, where RANGE is a 2-element vector containing the % minimum and maximum value for PVALUE. If PVALUE is a vector of values, % RANGE should be a (N-by-2) matrix where the first column contains % minimum values and the second column contains maximum values. % % SETFREEVALUERANGE(OPTIM, RANGE) sets the range for every free value. % RANGE must the same number of rows as there are free values. % Copyright 2005 The MathWorks, Inc. and Ford Global Technologies, Inc. if nargin==2 Range = pValue; pValue = getfreevalues(optim); end if length(pValue)==1 Range = Range(:).'; end G = optim.SetupGUID; ValObj = infoarray(pValue); for n = 1:length(pValue) ValObj{n} = setstorevalue(ValObj{n}, G, -1, Range(n, :)); end passign(pValue, ValObj);