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

    function obj = setTolerance(obj, tol)
%SETTOLERANCE Set the tolerance for the switch factors
%
%  OBJ = SETTOLERANCE(OBJ, TOL) sets the tolerance on the switch factors.
%  The tolerance is the relative amount that an input can miss a switched
%  model by and still be counted as hitting it.  TOL is a vector of values
%  the same length as the number of switch factors.

%  Copyright 2007 The MathWorks, Inc. 

if isscalar(tol) || length(tol)==size(obj.OpPoints,2)
    obj.Tolerance = tol;
else 
    error(message('mbc:conswitch:InvalidArgument'));
end