www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgoptim/getFreeValueRange.m

    function Range = getFreeValueRange(optim, pValue)
%GETFREEVALUERANGE Get the operating ranges of free variables
%
%  RANGE = GETFREEVALUERANGE(OPTIM) returns a (N-by-2) matrix where each
%  row contains the operating range for the corresponding free variable.
%
%  RANGE = GETFREEVALUERANGE(OPTIM, PVALUE) returns a matrix with
%  length(PVALUE) rows that contains the range information for the
%  specified variables.

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


if nargin<2
    pValue = getfreevalues(optim);
end

Range = zeros(length(pValue), 2);

G = optim.SetupGUID;
ValObj = infoarray(pValue);
for n = 1:length(pValue)
    R = getstorevalue(ValObj{n}, G, -1);
    if isempty(R)
        Range(n,:) = getrange(ValObj{n});
    else
        Range(n,:) = R;
    end
end