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

    function obj = setBounds(obj, bounds, dim)
%SETBOUNDS Set the gradient bounds on the variable
%
%   OBJ = SETBOUNDS(OBJ, BOUNDS) sets the gradient bounds on the variable
%   in all axes directions to be the NAXES-by-3 matrix, BOUNDS, the
%   structure of which is given below
%
%   BOUNDS(:, 1) : Maximum decrease in the variable per BOUNDS(:, 3) change
%   in axis variable
%   BOUNDS(:, 2) : Maximum increase in the variable per BOUNDS(:, 3) change
%   in axis variable
%   BOUNDS(:, 3) : Change in axis variable
%
%   OBJ = SETBOUNDS(OBJ, BOUNDS, DIM) sets the gradient bounds on the
%   variable in the DIM-th axis direction to be 1-by-3 matrix, BOUNDS.
%
%   See also CGTABGRADCONSTRAINT/GETBOUNDS

%   Copyright 2006-2007 The MathWorks, Inc.

% Error if change in axis variable is less than eps
if any(bounds(:, 3) < eps)
    error(message('mbc:cgtabgradconstraint:InvalidArgument'));
end

if nargin < 3
    obj.Bounds = bounds;
else
    obj.Bounds(dim, :) = bounds;
end

% Reset the working store if in static mode
if isStaticMode(obj)
    obj.WorkingStore.resetWorkingStore();
end