www.gusucode.com > mbcmodels 工具箱 matlab 源码程序 > mbcmodels/@xregmodswitch/getAbsoluteTolerance.m

    function tol = getAbsoluteTolerance(m)
%GETABSOLUTETOLERANCE Return absolute matching tolerance of switch model
%
%  TOL = GETTOLERANCE(M) returns a vector the same length as the number of
%  switching factors, containing the absolute matching tolerance for each
%  factor.  The absolute tolerance is the relative tolerance multiplied by
%  the variable range.

%  Copyright 2000-2009 The MathWorks, Inc. and Ford Global Technologies, Inc.


ng = size(m.OpPoints, 2);

% Input ranges
Bnds = m.ranges(:,end-ng+1:end);
range = diff(Bnds,[],1);

% Tolerance for comparison
tol = m.Tolerance.*range;