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

    function d = constraintDistance(c, X)
%CONSTRAINTDISTANCE Signed distance to constraint boundary for a list of points
% 
%  D = CONSTRAINTDISTANCE(CON, X) is the signed distance to the boundary of
%  the constraint CON for the list of points X. This method constitutes the
%  core definition of the constraint in terms of what is in and what is
%  out.
% 
%  X should be an array with nFactors( CON ) columns. D will be a vector
%  with the same number of rows as X.
%
%  See also CONTABLE2, CONBASE/CONSTRAINTDISTANCE, CONTABLE2/ISINSIDE.

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


factors = getActiveIndices( c );

DIST_MODE = 2;
d = xreginterp2d( c.breakrows, c.breakcols, c.table, ...
    factors([2, 1, 3]), c.le, X, DIST_MODE);

% Need to take into account the scale of the response, i.e., the z-axis
% or third active factor
cif = getActiveFactors( c );
sc = 0.5 * (getMax( cif(3) ) - getMin( cif(3) ));
d = d/sc;

%------------------------------------------------------------------------------|
% EOF
%------------------------------------------------------------------------------|